Merge remote-tracking branch 'origin/master'

This commit is contained in:
rusefi 2020-07-13 21:50:59 -04:00
commit a5389c238c
4 changed files with 137 additions and 53 deletions

View File

@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20200713
#define VCS_DATE 20200714

View File

@ -151,24 +151,23 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseAngle), "NaN baseAngle", false);
assertAngleRange(baseAngle, "baseAngle_r", CUSTOM_ERR_6554);
int injectorIndex;
injection_mode_e mode = engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE);
int injectorIndex;
if (mode == IM_SIMULTANEOUS || mode == IM_SINGLE_POINT) {
// These modes only have one injector
injectorIndex = 0;
} else if (mode == IM_SEQUENTIAL) {
} else if (mode == IM_SEQUENTIAL || (mode == IM_BATCH && CONFIG(twoWireBatchInjection))) {
// Map order index -> cylinder index (firing order)
injectorIndex = getCylinderId(i PASS_ENGINE_PARAMETER_SUFFIX) - 1;
} else if (mode == IM_BATCH) {
// does not look exactly right, not too consistent with IM_SEQUENTIAL
// Loop over the first half of the firing order twice
injectorIndex = i % (engineConfiguration->specs.cylindersCount / 2);
} else {
firmwareError(CUSTOM_OBD_UNEXPECTED_INJECTION_MODE, "Unexpected injection mode %d", mode);
injectorIndex = 0;
}
bool isSimultanious = mode == IM_SIMULTANEOUS;
assertAngleRange(baseAngle, "addFbaseAngle", CUSTOM_ADD_BASE);
int cylindersCount = CONFIG(specs.cylindersCount);
@ -186,13 +185,18 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
/**
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
*/
int secondIndex = injectorIndex + (CONFIG(specs.cylindersCount) / 2);
// Compute the position of this cylinder's twin in the firing order
// Each injector gets fired as a primary (the same as sequential), but also
// fires the injector 360 degrees later in the firing order.
int secondOrder = (i + (CONFIG(specs.cylindersCount) / 2)) % CONFIG(specs.cylindersCount);
int secondIndex = getCylinderId(secondOrder PASS_ENGINE_PARAMETER_SUFFIX) - 1;
secondOutput = &enginePins.injectors[secondIndex];
} else {
secondOutput = NULL;
secondOutput = nullptr;
}
InjectorOutputPin *output = &enginePins.injectors[injectorIndex];
bool isSimultanious = mode == IM_SIMULTANEOUS;
if (!isSimultanious && !output->isInitialized()) {
// todo: extract method for this index math

View File

@ -1,27 +1,68 @@
# Jenkins setup
https://git-scm.com/downloads
### Install Cygwin
https://cygwin.com/install.html
https://sliksvn.com/download/ used to produce numeric revision number needs to be added to System PATH manually
Cygwin packages that need to be installed:
- make
- gcc-core
- mingw64-i686-gcc-core
- mingw64-i686-gcc-g++
- mingw64-x86_64-gcc-core
- mingw64-x86_64-gcc-g++
- python3
- git
- subversion
- doxygen
- zip
- ncftp
- wget
- ccache
- graphviz
https://cygwin.com/install.html needs to be added to System PATH manually
### Install Java JDK 8
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
cygwin: make, gcc, zip, wget
cygwin: ccache
Add System Environment Variable
CCACHE_DIR
c:\ccache
java needs to be added to System PATH manually
https://ant.apache.org/ needs to be added to System PATH manually. used to build java stuff
### Install Ant:
https://ant.apache.org/
### Install Jenkins
https://jenkins.io/download/
Additional plugings:
### Install Kicad
http://www.kicad-pcb.org/download/
for iBom automation
Pipeline GitHub Notify Step
### Install for Hardware Testing
#### ST Link Utility
http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/utility/stsw-link004.zip
#### ST Virtual Serial Driver
http://www.st.com/web/en/catalog/tools/PF257938
### System Environment Variables:
|Variable|Example|
|--|--|
|CCACHE_DIR|C:\ccache |
|ANT_HOME|C:\Program Files\apache-ant-1.10.8|
|JAVA_HOME|C:\Program Files\Java\jdk1.8.0_251|
|RUSEFI_FTP_SERVER|ftp.yourdomain.com|
|RUSEFI_BUILD_FTP_USER|rusefi_firmware|
|RUSEFI_BUILD_FTP_PASS|secretpass|
|RUSEFI_DOXYGEN_FTP_USER|rusefi_doxygen|
|RUSEFI_DOXYGEN_FTP_PASS|secretpass|
### Add to Path:
|Tool|Example|
|--|--|
|Java|C:\Program Files (x86)\Common Files\Oracle\Java\javapath|
|Java|%JAVA_HOME%\bin|
|Ant|%ANT_HOME%\bin|
|Cygwin|C:\cygwin64\bin|
|GCC|C:\Program Files (x86)\GNU Arm Embedded Toolchain\9 2020-q2-update\bin|
### Additional Jenkins set-up
#### Additional plugins:
- Pipeline GitHub Notify Step
https://stackoverflow.com/questions/14274293/show-current-state-of-jenkins-build-on-github-repo
@ -33,33 +74,9 @@ smtphost: smtp.gmail.com
r***@gmail.com
useSsl=yes
https://www.ncftp.com/download/ !!! c:\windows !!! needs to be added to System PATH manually. This FTP client installs itself right into c:\windows folder
RUSEFI_BUILD_FTP_USER & RUSEFI_BUILD_FTP_PASS needs to be added to System PATH manually
RUSEFI_DOXYGEN_FTP_USER & RUSEFI_DOXYGEN_FTP_PASS needs to be added to System PATH manually
http://www.doxygen.nl/download.html needs to be added to System PATH manually
https://graphviz.gitlab.io/download/ needs to be added to System PATH manually, used by Doxygen
http://www.kicad-pcb.org/download/ for iBom automation
http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/utility/stsw-link004.zip ST Link Utility
http://www.st.com/web/en/catalog/tools/PF257938 ST virtual serial driver
Jobs:
### Jobs:
1) unit_tests
2) integration_and_primary_bundle
3) documentation
4) build_extra_bundles
5) git2svn_sync
RUSEFI_SVN_PASSWORD needs to be added to System PATH manually

View File

@ -566,12 +566,27 @@ TEST(misc, testTriggerDecoder) {
extern fuel_Map3D_t fuelMap;
static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset) {
static void assertInjectionEventBase(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset) {
ASSERT_EQ(injectorIndex, ev->outputs[0]->injectorIndex) << msg << "inj index";
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.triggerEventIndex);
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffsetFromTriggerEvent);
}
static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset) {
assertInjectionEventBase(msg, ev, injectorIndex, eventIndex, angleOffset);
// There should NOT be a second injector configured
EXPECT_EQ(nullptr, ev->outputs[1]);
}
static void assertInjectionEventBatch(const char *msg, InjectionEvent *ev, int injectorIndex, int secondInjectorIndex, int eventIndex, angle_t angleOffset) {
assertInjectionEventBase(msg, ev, injectorIndex, eventIndex, angleOffset);
// There should be a second injector - confirm it's the correct one
ASSERT_NE(nullptr, ev->outputs[1]);
EXPECT_EQ(secondInjectorIndex, ev->outputs[1]->injectorIndex);
}
static void setTestBug299(EngineTestHelper *eth) {
setupSimpleTestEngineWithMafAndTT_ONE_trigger(eth);
Engine *engine = &eth->engine;
@ -959,9 +974,57 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
doTestFuelSchedulerBug299smallAndMedium(1000);
}
TEST(big, testDifferentInjectionModes) {
printf("*************************************************** testDifferentInjectionModes\r\n");
TEST(big, testTwoWireBatch) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
engineConfiguration->injectionMode = IM_BATCH;
engineConfiguration->twoWireBatchInjection = true;
eth.fireTriggerEventsWithDuration(20);
// still no RPM since need to cycles measure cycle duration
eth.fireTriggerEventsWithDuration(20);
eth.clearQueue();
/**
* Trigger up - scheduling fuel for full engine cycle
*/
eth.fireRise(20);
FuelSchedule * t = &ENGINE(injectionEvents);
assertInjectionEventBatch("#0", &t->elements[0], 0, 3, 1, 153); // Cyl 1 and 4
assertInjectionEventBatch("#1_i_@", &t->elements[1], 2, 1, 1, 153 + 180); // Cyl 3 and 2
assertInjectionEventBatch("#2@", &t->elements[2], 3, 0, 0, 153); // Cyl 4 and 1
assertInjectionEventBatch("inj#3@", &t->elements[3], 1, 2, 0, 153 + 180); // Cyl 2 and 3
}
TEST(big, testSequential) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
engineConfiguration->injectionMode = IM_SEQUENTIAL;
eth.fireTriggerEventsWithDuration(20);
// still no RPM since need to cycles measure cycle duration
eth.fireTriggerEventsWithDuration(20);
eth.clearQueue();
/**
* Trigger up - scheduling fuel for full engine cycle
*/
eth.fireRise(20);
FuelSchedule * t = &ENGINE(injectionEvents);
assertInjectionEvent("#0", &t->elements[0], 0, 1, 126); // Cyl 1
assertInjectionEvent("#1_i_@", &t->elements[1], 2, 1, 126 + 180); // Cyl 3
assertInjectionEvent("#2@", &t->elements[2], 3, 0, 126); // Cyl 4
assertInjectionEvent("inj#3@", &t->elements[3], 1, 0, 126 + 180); // Cyl 2
}
TEST(big, testDifferentInjectionModes) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
setTestBug299(&eth);
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";