Merge branch 'bootloader' of https://github.com/andreika-git/rusefi into bootloader

This commit is contained in:
Andrei 2017-06-04 22:02:49 +03:00
commit f657c437e8
11 changed files with 2841 additions and 2697 deletions

View File

@ -25,8 +25,6 @@ EXTERN_ENGINE
static Logging *logger;
int alternatorPidResetCounter = 0;
static SimplePwm alternatorControl;
static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
static Pid altPid(altPidS);
@ -53,7 +51,6 @@ static msg_t AltCtrlThread(int param) {
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
if (shouldResetPid) {
pidReset();
alternatorPidResetCounter++;
shouldResetPid = false;
}
#endif
@ -65,7 +62,6 @@ static msg_t AltCtrlThread(int param) {
// this block could be executed even in on/off alternator control mode
// but at least we would reflect latest state
altPid.postState(&tsOutputChannels);
tsOutputChannels.debugIntField3 = alternatorPidResetCounter;
}
#endif /* !EFI_UNIT_TEST */

View File

@ -21,9 +21,9 @@ Pid::Pid(pid_s *pid) {
void Pid::init(pid_s *pid) {
this->pid = pid;
resetCounter = 0;
dTerm = iTerm = 0;
prevResult = prevInput = prevTarget = prevError = 0;
reset();
}
bool Pid::isSame(pid_s *pid) {
@ -50,11 +50,11 @@ float Pid::getValue(float target, float input, float dTime) {
* If we have exceeded the ability of the controlled device to hit target, the I factor will keep accumulating and approach infinity.
* Here we limit the I-term #353
*/
if (iTerm > pid->maxValue - (pTerm + dTerm + pid->offset))
iTerm = pid->maxValue - (pTerm + dTerm + pid->offset);
if (iTerm > pid->maxValue)
iTerm = pid->maxValue;
if (iTerm < pid->minValue - (pTerm + dTerm + pid->offset))
iTerm = pid->minValue - (pTerm + dTerm + pid->offset);
if (iTerm < pid->minValue)
iTerm = pid->minValue;
float result = pTerm + iTerm + dTerm + pid->offset;
if (result > pid->maxValue) {
@ -74,8 +74,9 @@ void Pid::updateFactors(float pFactor, float iFactor, float dFactor) {
}
void Pid::reset(void) {
iTerm = 0;
prevError = 0;
dTerm = iTerm = 0;
prevResult = prevInput = prevTarget = prevError = 0;
resetCounter++;
}
float Pid::getP(void) {
@ -113,6 +114,7 @@ void Pid::postState(TunerStudioOutputChannels *tsOutputChannels) {
tsOutputChannels->debugFloatField7 = pid->maxValue;
tsOutputChannels->debugIntField1 = getP();
tsOutputChannels->debugIntField2 = getOffset();
tsOutputChannels->debugIntField3 = resetCounter;
tsOutputChannels->debugFloatField6 = dTerm;
}
#endif

View File

@ -44,6 +44,7 @@ public:
float dTerm; // we are remembering this only for debugging purposes
void showPidStatus(Logging *logging, const char*msg);
void sleep();
int resetCounter;
private:
pid_s *pid;

View File

@ -260,5 +260,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20170529;
return 20170602;
}

View File

@ -1,5 +1,5 @@
// This file was generated by Version2Header
// Fri Jun 02 14:01:36 EEST 2017
// Fri Jun 02 23:03:47 EDT 2017
#ifndef VCS_VERSION
#define VCS_VERSION "14274"
#define VCS_VERSION "14281"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
(export (version D)
(design
(source C:/Users/Vista_64_D630/Desktop/Jared/code/Hardware/trunk/rusefi.com/brain_board_STM32F407/brain_board_STM32F407.sch)
(date "1/18/2017 7:43:35 PM")
(date "4/28/2017 6:02:02 AM")
(tool "Eeschema 4.0.5")
(sheet (number 1) (name /) (tstamps /)
(title_block
(title)
(company "rusEFI by Art_Electro")
(rev R0.2)
(date 2016-12-23)
(rev R0.4)
(date 2017-02-18)
(source brain_board_STM32F407.sch)
(comment (number 1) (value ""))
(comment (number 2) (value ""))
@ -203,25 +203,25 @@
(tstamp 52D15C06))
(comp (ref JP1)
(value JUMPER)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(footprint rusEFI_LIB:SM0805_jumper)
(libsource (lib KICAD_Older_Version) (part JUMPER))
(sheetpath (names /) (tstamps /))
(tstamp 52D15D96))
(comp (ref JP2)
(value JUMPER)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(footprint rusEFI_LIB:SM0805_jumper)
(libsource (lib KICAD_Older_Version) (part JUMPER))
(sheetpath (names /) (tstamps /))
(tstamp 52D15DA3))
(comp (ref JP4)
(value JUMPER)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(footprint rusEFI_LIB:SM0805_jumper)
(libsource (lib KICAD_Older_Version) (part JUMPER))
(sheetpath (names /) (tstamps /))
(tstamp 52D15DC3))
(comp (ref JP3)
(value JUMPER)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(footprint rusEFI_LIB:SM0805_jumper)
(libsource (lib KICAD_Older_Version) (part JUMPER))
(sheetpath (names /) (tstamps /))
(tstamp 52D15DD0))
@ -806,10 +806,10 @@
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive)))))
(libraries
(library (logical KICAD_Older_Version)
(uri C:\Users\Vista_64_D630\Desktop\Jared\code\Hardware\trunk\rusefi.com\rusefi_lib\KICAD_Older_Version.lib))
(library (logical "crystal(mc306)")
(uri "C:\\Users\\Vista_64_D630\\Desktop\\Jared\\code\\Hardware\\trunk\\rusefi.com\\rusefi_lib\\crystal(mc306).lib"))
(library (logical KICAD_Older_Version)
(uri C:\Users\Vista_64_D630\Desktop\Jared\code\Hardware\trunk\rusefi.com\rusefi_lib\KICAD_Older_Version.lib))
(library (logical conn)
(uri "C:\\Program Files\\KiCad\\share\\kicad\\library\\conn.lib")))
(nets

View File

@ -1116,7 +1116,7 @@ U 1 1 52D15D96
P 3100 7700
F 0 "JP1" H 3100 7850 60 0000 C CNN
F 1 "JUMPER" H 3100 7620 40 0000 C CNN
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 3100 7700 60 0001 C CNN
F 2 "rusEFI_LIB:SM0805_jumper" H 3100 7700 60 0001 C CNN
F 3 "" H 3100 7700 60 0000 C CNN
1 3100 7700
1 0 0 -1
@ -1127,7 +1127,7 @@ U 1 1 52D15DA3
P 3100 8025
F 0 "JP2" H 3100 8175 60 0000 C CNN
F 1 "JUMPER" H 3100 7945 40 0000 C CNN
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 3100 8025 60 0001 C CNN
F 2 "rusEFI_LIB:SM0805_jumper" H 3100 8025 60 0001 C CNN
F 3 "" H 3100 8025 60 0000 C CNN
1 3100 8025
1 0 0 -1
@ -1138,7 +1138,7 @@ U 1 1 52D15DC3
P 3100 8700
F 0 "JP4" H 3100 8850 60 0000 C CNN
F 1 "JUMPER" H 3100 8620 40 0000 C CNN
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 3100 8700 60 0001 C CNN
F 2 "rusEFI_LIB:SM0805_jumper" H 3100 8700 60 0001 C CNN
F 3 "" H 3100 8700 60 0000 C CNN
1 3100 8700
1 0 0 -1
@ -1149,7 +1149,7 @@ U 1 1 52D15DD0
P 3100 8350
F 0 "JP3" H 3100 8500 60 0000 C CNN
F 1 "JUMPER" H 3100 8270 40 0000 C CNN
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 3100 8350 60 0001 C CNN
F 2 "rusEFI_LIB:SM0805_jumper" H 3100 8350 60 0001 C CNN
F 3 "" H 3100 8350 60 0000 C CNN
1 3100 8350
1 0 0 -1

View File

@ -2,13 +2,14 @@
2) RESOLVED IN R0.2 add vertical USB connector option (same as on Frankenso)
3) RESOLVED IN R0.2 use stlink 5x2 header
4) RESOLVED IN R0.2 renamed sm32f407_Board to STM32F407_Brain_Board
5) change LED to use SM0806_Jumpers
5) RESOLVED IN R0.4 Some fab shops do not like soldering 0R 0805 on JUMPER footprint. Need to convert JP1, JP2, JP3 & JP4 to "SM0805_jumper"
6) RESOLVED IN R0.2 Change Fuse to match frankenso
7) RESOLVED IN R0.2 set solder mask to 0.003 inches, per OSHPark suggestion.
8) RESOLVED IN R0.3 Check if there is a chance to match discovery board reset button location
9) RESOLVED IN R0.3 Move push buttons to match the STM32F407 Discovery board's locations.
10) RESOLVED IN R0.3 Changed diodes to 0805 diodes.
11) RESOLVED IN R0.4 Added zone cut outs such that boards can have engraved serial numbers.
12) Some fab shops do not like soldering 0R 0805 on JUMPER footprint. Need to convert JP1, JP2, JP3 & JP4 to "SM0805_jumper"
13) as another approach to #12 problem, maybe we can add traces connecting JP1, JP2, JP3 & JP4 pads? On the back? By defult the trace would be used, if desired trace could be removed with a knife?
14) RESET and USER button HUGE silkscreen is needed
12) as another approach to #5 problem, maybe we can add traces connecting JP1, JP2, JP3 & JP4 pads? On the back? By defult the trace would be used, if desired trace could be removed with a knife?
13) RESET and USER button HUGE silkscreen is needed

View File

@ -148,8 +148,7 @@
145) RESOLVED IN R0.4.3 HI/LO net names are confusing, and jumbled.
146) RESOLVED IN R0.5 HI/LO 2 silk screen is on wrong harness pin.
147) RESOLVED IN R0.5 Add 232 TX and RX connection points for external MAX232 or equiv chip SEE P701
148) route NC located next to PD15 to 3.3V battery+ / RTC mod / see http://rusefi.com/forum/viewtopic.php?f=4&t=460
148) route NC located next to PD15 to 3.3V battery+ / RTC mod / see viewtopic.php?f=4&t=460
For honda add-on / rewiring board

View File

@ -21,6 +21,7 @@ void testPidController(void) {
pidS.offset = 0;
pidS.minValue = 10;
pidS.maxValue = 90;
pidS.period = 1;
Pid pid(&pidS);
@ -40,4 +41,28 @@ void testPidController(void) {
assertEquals(10, pid.getValue(14, 16, 1));
// assertEquals(68, pid.getIntegration());
pidS.pFactor = 1;
pidS.iFactor = 0;
pidS.dFactor = 0;
pidS.offset = 0;
pidS.minValue = 0;
pidS.maxValue = 100;
pidS.period = 1;
pid.reset();
assertEqualsM("target=50, input=0", 50, pid.getValue(/*target*/50, /*input*/0));
assertEqualsM("target=50, input=0 iTerm", 0, pid.iTerm);
assertEqualsM("target=50, input=70", 0, pid.getValue(/*target*/50, /*input*/70));
assertEqualsM("target=50, input=70 iTerm", 0, pid.iTerm);
assertEqualsM("target=50, input=70 #2", 0, pid.getValue(/*target*/50, /*input*/70));
assertEqualsM("target=50, input=70 iTerm #2", 0, pid.iTerm);
assertEqualsM("target=50, input=50", 0, pid.getValue(/*target*/50, /*input*/50));
assertEqualsM("target=50, input=50 iTerm", 0, pid.iTerm);
}