From 03e6c2d4760aa91b11aa1367ae22309261fb6057 Mon Sep 17 00:00:00 2001 From: Murray Date: Mon, 1 Jan 2018 15:39:43 -0600 Subject: [PATCH 01/12] Software controlled auto-reset prevention This feature enables the Speeduino to set a pin high that will tell the Arduino's 8U2/16U2 firmware not to reset on new serial connections. This requires a slightly modified firmware for the 8U2/16U2 that will only reset on DTR when PB7 is also held low. --- reference/speeduino.ini | 24 ++++++++++++++++++++++-- speeduino/comms.h | 2 +- speeduino/comms.ino | 4 +++- speeduino/globals.h | 22 ++++++++++++++++++++-- speeduino/speeduino.ino | 31 ++++++++++++++++++++++++++++++- speeduino/utils.ino | 12 ++++++++++++ 6 files changed, 88 insertions(+), 7 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 009ff753..2e81c0cb 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -282,7 +282,8 @@ page = 4 sparkDur = scalar, U08, 7, "ms", 0.1, 0, 0, 25.5, 1 ; Spark duration unused4-8 = scalar, U08, 8, "ms", 0.1, 0.0, 0.0, 25.5, 1 unused4-9 = scalar, U08, 9, "ms", 0.1, 0.0, 0.0, 25.5, 1 - unused4-10 = scalar, U08, 10, "ms", 0.1, 0.0, 0.0, 25.5, 1 + resetLock = bits, U08, 10,[0:1], "Never", "When Running", "Always", "INVALID" + resetLockPin = bits, U08, 10,[2:7], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" SkipCycles = scalar, U08, 11, "cycles", 1, 0, 0, 255, 0 ; name = array, type, offset, shape, units, scale, translate, lo, hi, digits @@ -753,6 +754,8 @@ page = 10 requiresPowerCycle = stagedInjSizePri requiresPowerCycle = stagedInjSizeSec requiresPowerCycle = stagingEnabled + requiresPowerCycle = resetLock + requiresPowerCycle = resetLockPin defaultValue = pinLayout, 1 defaultValue = TrigPattern, 0 @@ -801,6 +804,7 @@ page = 10 defaultValue = realtime_base_address, 336 defaultValue = VVTasOnOff, 0 defaultValue = stagingEnabled, 0 + defaultValue = resetLock, 0 ; defaultValue = obd_address, 0 ;Default pins @@ -811,6 +815,7 @@ page = 10 defaultValue = fuelPumpPin, 0 defaultValue = tachoPin, 0 defaultValue = perToothIgn, 0 + defaultValue = resetLockPin, 0 [Menu] ;---------------------------------------------------------------------------- @@ -904,6 +909,10 @@ menuDialog = main subMenu = serial3IO, "Secondary Serial IO Interface" #endif + subMenu = std_separator + + subMenu = reset_lock, "Reset Lock" + menuDialog = main menu = "T&ools" subMenu = mapCal, "Calibrate MAP" @@ -1091,6 +1100,9 @@ menuDialog = main stagedInjSizePri= "Size of the primary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" stagedInjSizeSec= "Size of the secondary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" + + resetLock = "When the Speeduino should be locked against auto reset by serial connection." + resetLockPin = "The Arduino pin that you have connected to pin PB7 on its 8U2 / 16U2 serial comm controller." [UserDefined] @@ -1797,6 +1809,10 @@ menuDialog = main topicHelp = "http://speeduino.com/wiki/index.php/Serial3_IO_interface" field = "Enable Second Serial", enable_canbus + dialog = reset_lock, "Reset Lock" + field = "Use Reset Lock", resetLock + field = "Reset Lock Pin", resetLockPin + ;------------------------------------------------------------------------------- ; General help text @@ -2230,6 +2246,7 @@ cmdtestspk450dc = "E\x03\x0C" indicator = { hardLimitOn }, "Hard Limit OFF","Hard Limiter", white, black, red, black indicator = { boostCutOut }, "Ign Cut OFF", "Ign Cut (Boost)", white, black, red, black indicator = { sync }, "No Sync", "Sync", white, black, green, black + indicator = { resetLockOn }, "Reset Lock ON", "Reset Lock OFF", white, black, green, black ;------------------------------------------------------------------------------- @@ -2240,7 +2257,7 @@ cmdtestspk450dc = "E\x03\x0C" ; you change it. ochGetCommand = "r\$tsCanId\x30%2o%2c" - ochBlockSize = 81 + ochBlockSize = 82 secl = scalar, U08, 0, "sec", 1.000, 0.000 status1 = scalar, U08, 1, "bits", 1.000, 0.000 @@ -2327,6 +2344,9 @@ cmdtestspk450dc = "E\x03\x0C" pulseWidth2 = scalar, U16, 75, "ms", 0.001, 0.000 pulseWidth3 = scalar, U16, 77, "ms", 0.001, 0.000 pulseWidth4 = scalar, U16, 79, "ms", 0.001, 0.000 + status3 = scalar, U08, 81, "bits", 1.000, 0.000 + resetLockOn = bits, U08, 81, [0:0] + unused81_1-7 = bits, U08, 81, [1:7] #if CELSIUS coolant = { coolantRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives diff --git a/speeduino/comms.h b/speeduino/comms.h index c18ff689..90b16e6b 100644 --- a/speeduino/comms.h +++ b/speeduino/comms.h @@ -12,7 +12,7 @@ #define canbusPage 9//Config Page 9 #define warmupPage 10 //Config Page 10 -#define SERIAL_PACKET_SIZE 81 +#define SERIAL_PACKET_SIZE 82 byte currentPage = 1;//Not the same as the speeduino config page numbers bool isMap = true; diff --git a/speeduino/comms.ino b/speeduino/comms.ino index 294be1a4..e8105cc4 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -457,6 +457,8 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum) fullStatus[79] = lowByte(currentStatus.PW4); //Pulsewidth 4 multiplied by 10 in ms. Have to convert from uS to mS. fullStatus[80] = highByte(currentStatus.PW4); //Pulsewidth 4 multiplied by 10 in ms. Have to convert from uS to mS. + fullStatus[81] = currentStatus.status3; + for(byte x=0; x Date: Sun, 7 Jan 2018 16:22:18 -0600 Subject: [PATCH 02/12] Reset Control Changed reset lock feature to a more general "reset control" feature. Moved reset control settings to the general Settings menu. added a serial U command that will halt comms and set the control pin low when another byte is received to facilitate reset control for devices that lack an AtmegaXXu2 usb controller. Improved context help for reset control. Corrected reset lock status indicator on / off labels. moved reset control setup to utils.ino. --- reference/speeduino.ini | 32 ++++++++++------------- speeduino/comms.ino | 10 ++++++++ speeduino/globals.h | 18 ++++++++----- speeduino/speeduino.ino | 34 ++++++------------------ speeduino/utils.ino | 57 +++++++++++++++++++++++++++++++++-------- 5 files changed, 89 insertions(+), 62 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 2e81c0cb..1331ca50 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -282,8 +282,8 @@ page = 4 sparkDur = scalar, U08, 7, "ms", 0.1, 0, 0, 25.5, 1 ; Spark duration unused4-8 = scalar, U08, 8, "ms", 0.1, 0.0, 0.0, 25.5, 1 unused4-9 = scalar, U08, 9, "ms", 0.1, 0.0, 0.0, 25.5, 1 - resetLock = bits, U08, 10,[0:1], "Never", "When Running", "Always", "INVALID" - resetLockPin = bits, U08, 10,[2:7], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" + resetControl = bits, U08, 10,[0:1], "Disabled", "Prevent When Running", "Prevent Always", "Serial Command" + resetControlPin = bits, U08, 10,[2:7], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" SkipCycles = scalar, U08, 11, "cycles", 1, 0, 0, 255, 0 ; name = array, type, offset, shape, units, scale, translate, lo, hi, digits @@ -754,8 +754,8 @@ page = 10 requiresPowerCycle = stagedInjSizePri requiresPowerCycle = stagedInjSizeSec requiresPowerCycle = stagingEnabled - requiresPowerCycle = resetLock - requiresPowerCycle = resetLockPin + requiresPowerCycle = resetControl + requiresPowerCycle = resetControlPin defaultValue = pinLayout, 1 defaultValue = TrigPattern, 0 @@ -804,7 +804,7 @@ page = 10 defaultValue = realtime_base_address, 336 defaultValue = VVTasOnOff, 0 defaultValue = stagingEnabled, 0 - defaultValue = resetLock, 0 + defaultValue = resetControl, 0 ; defaultValue = obd_address, 0 ;Default pins @@ -815,7 +815,7 @@ page = 10 defaultValue = fuelPumpPin, 0 defaultValue = tachoPin, 0 defaultValue = perToothIgn, 0 - defaultValue = resetLockPin, 0 + defaultValue = resetControlPin, 0 [Menu] ;---------------------------------------------------------------------------- @@ -850,7 +850,7 @@ menuDialog = main subMenu = triggerSettings, "Trigger Setup" ;subMenu = OLED, "OLED Setup" subMenu = airdensity_curve, "IAT Density" - + subMenu = reset_control, "Reset Control" menu = "&Tuning" subMenu = std_realtime, "Realtime Display" @@ -909,10 +909,6 @@ menuDialog = main subMenu = serial3IO, "Secondary Serial IO Interface" #endif - subMenu = std_separator - - subMenu = reset_lock, "Reset Lock" - menuDialog = main menu = "T&ools" subMenu = mapCal, "Calibrate MAP" @@ -1100,9 +1096,9 @@ menuDialog = main stagedInjSizePri= "Size of the primary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" stagedInjSizeSec= "Size of the secondary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" - - resetLock = "When the Speeduino should be locked against auto reset by serial connection." - resetLockPin = "The Arduino pin that you have connected to pin PB7 on its 8U2 / 16U2 serial comm controller." + + resetControl = "How to control the Arduino's automatic reset feature. NOTE: Some of these settings require modifying your hardware and possibly replacing the Arduino bootloader. See the Wiki for more details.\n\nDisabled: Allow the Arduino to reset when a new serial connection is made.\n\nPrevent When Running: Hold the control pin high while the engine is running.\n\nPrevent Always: Always hold the control pin high.\n\nSerial Command: Normally hold the control pin high, but pull it low when the 'U' serial command is issued and reset upon receiving more data." + resetControlPin = "The Arduino pin used to control resets." [UserDefined] @@ -1809,9 +1805,9 @@ menuDialog = main topicHelp = "http://speeduino.com/wiki/index.php/Serial3_IO_interface" field = "Enable Second Serial", enable_canbus - dialog = reset_lock, "Reset Lock" - field = "Use Reset Lock", resetLock - field = "Reset Lock Pin", resetLockPin + dialog = reset_control, "Reset Control" + field = "Control Type", resetControl + field = "Control Pin", resetControlPin ;------------------------------------------------------------------------------- ; General help text @@ -2246,7 +2242,7 @@ cmdtestspk450dc = "E\x03\x0C" indicator = { hardLimitOn }, "Hard Limit OFF","Hard Limiter", white, black, red, black indicator = { boostCutOut }, "Ign Cut OFF", "Ign Cut (Boost)", white, black, red, black indicator = { sync }, "No Sync", "Sync", white, black, green, black - indicator = { resetLockOn }, "Reset Lock ON", "Reset Lock OFF", white, black, green, black + indicator = { resetLockOn }, "Reset Lock OFF","Reset Lock ON", red, black, green, black ;------------------------------------------------------------------------------- diff --git a/speeduino/comms.ino b/speeduino/comms.ino index e8105cc4..7632ae66 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -183,6 +183,15 @@ void command() break; + case 'U': //User wants to reset the Arduino (probably for FW update) + #ifndef SMALL_FLASH_MODE + if (!cmdPending) { Serial.println(F("Comms halted. Next byte will reset the Arduino.")); } + #endif + + while (Serial.available() == 0) { } + digitalWrite(pinResetControl, LOW); + break; + case 'V': // send VE table and constants in binary sendPage(false); break; @@ -320,6 +329,7 @@ void command() "Z - Display calibration values\n" "T - Displays 256 tooth log entries in binary\n" "r - Displays 256 tooth log entries\n" + "U - Prepare for firmware update. The next byte received will cause the Arduino to reset.\n" "? - Displays this help page" )); #endif diff --git a/speeduino/globals.h b/speeduino/globals.h index b16364b7..1f527b16 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -98,7 +98,7 @@ #define BIT_TIMER_15HZ 3 #define BIT_TIMER_30HZ 4 -#define BIT_STATUS3_RESET_LOCK 0 //Indicates whether reset lock is active +#define BIT_STATUS3_RESET_PREVENT 0 //Indicates whether reset prevention is enabled #define BIT_STATUS3_UNUSED2 1 #define BIT_STATUS3_UNUSED3 2 #define BIT_STATUS3_UNUSED4 3 @@ -145,9 +145,10 @@ #define STAGING_MODE_TABLE 0 #define STAGING_MODE_AUTO 1 -#define RESET_LOCK_DISABLED 0 -#define RESET_LOCK_WHEN_RUNNING 1 -#define RESET_LOCK_ALWAYS 2 +#define RESET_CONTROL_DISABLED 0 +#define RESET_CONTROL_PREVENT_WHEN_RUNNING 1 +#define RESET_CONTROL_PREVENT_ALWAYS 2 +#define RESET_CONTROL_SERIAL_COMMAND 3 #define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance #define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke @@ -238,6 +239,9 @@ int ignition4EndAngle = 0; //This is used across multiple files unsigned long revolutionTime; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that) +//This needs to be here because using the config page directly can prevent burning the setting +byte resetControl = RESET_CONTROL_DISABLED; + volatile byte TIMER_mask; volatile byte LOOP_TIMER; @@ -445,8 +449,8 @@ struct config2 { byte unused4_9; //byte unused4_10; - byte resetLock : 2; // When to lock the 8u2/16u2 against reset on DTR (0=Never, 1=With Sync, 2=Always, 4=Not currently used) - byte resetLockPin : 6; + byte resetControl : 2; //Which method of reset control to use (0=None, 1=Prevent When Running, 2=Prevent Always, 3=Serial Command) + byte resetControlPin : 6; byte StgCycles; //The number of initial cycles before the ignition should fire when first cranking @@ -722,7 +726,7 @@ byte pinLaunch; byte pinIgnBypass; //The pin used for an ignition bypass (Optional) byte pinFlex; //Pin with the flex sensor attached byte pinBaro; //Pin that an external barometric pressure sensor is attached to (If used) -byte pinResetLock; // Output pin used to tell the 8u2/16u2 not to reset on DTR +byte pinResetControl; // Output pin used control resetting the Arduino // global variables // from speeduino.ino extern struct statuses currentStatus; // from speeduino.ino diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index e83b630f..33306cf1 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -665,24 +665,6 @@ void setup() setFuelSchedule3(100, (unsigned long)(configPage1.primePulse * 100)); setFuelSchedule4(100, (unsigned long)(configPage1.primePulse * 100)); - //Setup reset lock initial state - switch (configPage2.resetLock) { - case RESET_LOCK_WHEN_RUNNING: - //Set the reset lock pin LOW and change it to HIGH later when we get sync. - digitalWrite(pinResetLock, LOW); - BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_LOCK); - break; - case RESET_LOCK_ALWAYS: - //Set the reset lock pin HIGH and never touch it again. - digitalWrite(pinResetLock, HIGH); - BIT_SET(currentStatus.status3, BIT_STATUS3_RESET_LOCK); - break; - default: - //Either disabled or set to an invalid value. Do nothing. - BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_LOCK); - break; - } - initialisationComplete = true; digitalWrite(LED_BUILTIN, HIGH); } @@ -1554,16 +1536,16 @@ void loop() } } //Ignition schedules on - if (!BIT_CHECK(currentStatus.status3, BIT_STATUS3_RESET_LOCK) && configPage2.resetLock == RESET_LOCK_WHEN_RUNNING) { - //Reset lock is supposed to be set while synced but isn't. Fix that. - digitalWrite(pinResetLock, HIGH); - BIT_SET(currentStatus.status3, BIT_STATUS3_RESET_LOCK); + if (!BIT_CHECK(currentStatus.status3, BIT_STATUS3_RESET_PREVENT) && resetControl == RESET_CONTROL_PREVENT_WHEN_RUNNING) { + //Reset prevention is supposed to be on while the engine is running but isn't. Fix that. + digitalWrite(pinResetControl, HIGH); + BIT_SET(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); } } //Has sync and RPM - else if (BIT_CHECK(currentStatus.status3, BIT_STATUS3_RESET_LOCK) && configPage2.resetLock == RESET_LOCK_WHEN_RUNNING) { - digitalWrite(pinResetLock, LOW); - BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_LOCK); - } + else if (BIT_CHECK(currentStatus.status3, BIT_STATUS3_RESET_PREVENT) && resetControl == RESET_CONTROL_PREVENT_WHEN_RUNNING) { + digitalWrite(pinResetControl, LOW); + BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); + } } //loop() /* diff --git a/speeduino/utils.ino b/speeduino/utils.ino index 4e43634a..8b67dfae 100644 --- a/speeduino/utils.ino +++ b/speeduino/utils.ino @@ -48,6 +48,32 @@ byte pinTranslate(byte rawPin) return outputPin; } +void setResetControlPinState() +{ + BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); + + /* Setup reset control initial state */ + switch (resetControl) + { + case RESET_CONTROL_PREVENT_WHEN_RUNNING: + /* Set the reset control pin LOW and change it to HIGH later when we get sync. */ + digitalWrite(pinResetControl, LOW); + BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); + break; + case RESET_CONTROL_PREVENT_ALWAYS: + /* Set the reset control pin HIGH and never touch it again. */ + digitalWrite(pinResetControl, HIGH); + BIT_SET(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); + break; + case RESET_CONTROL_SERIAL_COMMAND: + /* Set the reset control pin HIGH. There currently isn't any practical difference + between this and PREVENT_ALWAYS but it doesn't hurt anything to have them separate. */ + digitalWrite(pinResetControl, HIGH); + BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_PREVENT); + break; + } +} + void setPinMapping(byte boardID) { switch (boardID) @@ -80,7 +106,7 @@ void setPinMapping(byte boardID) pinFuelPump = 4; //Fuel pump output pinTachOut = 49; //Tacho output pin pinFlex = 19; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 43; //Reset lock output + pinResetControl = 43; //Reset control output #endif break; case 1: @@ -113,7 +139,7 @@ void setPinMapping(byte boardID) pinFan = 47; //Pin for the fan output pinFuelPump = 4; //Fuel pump output pinFlex = 2; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 43; //Reset lock output + pinResetControl = 43; //Reset control output break; #endif case 2: @@ -150,7 +176,7 @@ void setPinMapping(byte boardID) pinFan = A13; //Pin for the fan output pinLaunch = 12; //Can be overwritten below pinFlex = 2; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 50; //Reset lock output + pinResetControl = 50; //Reset control output #if defined(CORE_TEENSY) pinTrigger = 23; @@ -199,7 +225,7 @@ void setPinMapping(byte boardID) pinFan = 47; //Pin for the fan output (Goes to ULN2803) pinLaunch = 12; //Can be overwritten below pinFlex = 2; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 43; //Reset lock output + pinResetControl = 43; //Reset control output #if defined(CORE_TEENSY) pinTrigger = 23; @@ -309,7 +335,7 @@ void setPinMapping(byte boardID) pinFan = 35; //Pin for the fan output pinLaunch = 12; //Can be overwritten below pinFlex = 3; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 44; //Reset lock output + pinResetControl = 44; //Reset control output #if defined(CORE_TEENSY) pinTrigger = 23; @@ -359,7 +385,7 @@ void setPinMapping(byte boardID) pinFan = 47; //Pin for the fan output pinTachOut = 49; //Tacho output pin pinFlex = 2; // Flex sensor (Must be external interrupt enabled) - pinResetLock = 26; //Reset lock output + pinResetControl = 26; //Reset control output #endif break; @@ -396,7 +422,7 @@ void setPinMapping(byte boardID) pinFan = 47; //Pin for the fan output pinFuelPump = 4; //Fuel pump output pinTachOut = 49; //Tacho output pin - pinResetLock = 26; //Reset lock output + pinResetControl = 26; //Reset control output #endif break; @@ -479,7 +505,7 @@ void setPinMapping(byte boardID) pinSpareLOut1 = 32; //low current output spare1 - ONLY WITH DB pinSpareLOut2 = 34; //low current output spare2 - ONLY WITH DB pinSpareLOut3 = 36; //low current output spare3 - ONLY WITH DB - pinResetLock = 26; //Reset lock output + pinResetControl = 26; //Reset control output break; default: @@ -512,7 +538,7 @@ void setPinMapping(byte boardID) pinFlex = 3; // Flex sensor (Must be external interrupt enabled) pinBoost = 5; pinIdle1 = 6; - pinResetLock = 43; //Reset lock output + pinResetControl = 43; //Reset control output #endif break; } @@ -527,7 +553,17 @@ void setPinMapping(byte boardID) if ( (configPage3.boostPin != 0) && (configPage3.boostPin < BOARD_NR_GPIO_PINS) ) { pinBoost = pinTranslate(configPage3.boostPin); } if ( (configPage3.vvtPin != 0) && (configPage3.vvtPin < BOARD_NR_GPIO_PINS) ) { pinVVT_1 = pinTranslate(configPage3.vvtPin); } if ( (configPage3.useExtBaro != 0) && (configPage3.baroPin < BOARD_NR_GPIO_PINS) ) { pinBaro = configPage3.baroPin + A0; } - if ( (configPage2.resetLock != 0) && (configPage2.resetLockPin < BOARD_NR_GPIO_PINS) ) { pinResetLock = pinTranslate(configPage2.resetLockPin); } + + /* Reset control is a special case. If reset control is enabled, it needs its initial state set BEFORE its pinMode. + If that doesn't happen and reset control is in "Serial Command" mode, the Arduino will end up in a reset loop + because the control pin will go low as soon as the pinMode is set to OUTPUT. */ + if ( (configPage2.resetControl != 0) && (configPage2.resetControlPin < BOARD_NR_GPIO_PINS) ) + { + resetControl = configPage2.resetControl; + pinResetControl = pinTranslate(configPage2.resetControlPin); + setResetControlPinState(); + pinMode(pinResetControl, OUTPUT); + } //Finally, set the relevant pin modes for outputs pinMode(pinCoil1, OUTPUT); @@ -551,7 +587,6 @@ void setPinMapping(byte boardID) pinMode(pinStepperEnable, OUTPUT); pinMode(pinBoost, OUTPUT); pinMode(pinVVT_1, OUTPUT); - pinMode(pinResetLock, OUTPUT); inj1_pin_port = portOutputRegister(digitalPinToPort(pinInjector1)); inj1_pin_mask = digitalPinToBitMask(pinInjector1); From 3db83193200dd2115981c54b937801e46a685ce6 Mon Sep 17 00:00:00 2001 From: Murray Date: Sun, 7 Jan 2018 16:50:40 -0600 Subject: [PATCH 03/12] Atmega16u2 firmware that supports reset control With this firmware installed, auto reset on DTR will only work if PINB7 is held LOW. --- ...ino-usbserial-atmega16u2-Mega2560-Rev3.hex | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex diff --git a/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex new file mode 100644 index 00000000..3eb3d71c --- /dev/null +++ b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex @@ -0,0 +1,251 @@ +:1000000092C00000ABC00000A9C00000A7C0000063 +:10001000A5C00000A3C00000A1C000009FC0000058 +:100020009DC000009BC0000099C000000FC40000EC +:10003000B4C4000093C0000091C000008FC0000055 +:100040008DC000008BC0000089C0000087C0000088 +:1000500085C0000083C0000081C00000D6C1000040 +:100060007DC000007BC0000079C0000077C00000A8 +:1000700075C000002803530070006500650064002F +:10008000750069006E006F0020004D00650067007C +:1000900061002000320035003600300000003203DD +:1000A000410072006400750069006E006F0020005E +:1000B00028007700770077002E006100720064004E +:1000C000750069006E006F002E0063006300290058 +:1000D00000000403090409023E00020100C03209C5 +:1000E00004000001020201000524000110042402A2 +:1000F000060524060001070582030800FF09040124 +:1001000000020A0000000705040240000107058301 +:10011000024000011201100102000008EB034B2015 +:1001200001000102DC0111241FBECFEFD2E0DEBFCF +:10013000CDBF11E0A0E0B1E0E2E7FFE002C0059032 +:100140000D92A631B107D9F722E0A6E1B1E001C0D6 +:100150001D92AF32B207E1F72DD009C751CF84B756 +:10016000877F84BF0FB6F894A8958091600088615E +:1001700080936000109260000FBE87E690E090933D +:10018000CD008093CC0086E08093CA001092C80016 +:1001900088E18093C900539A5A9A8AB180638AB9D8 +:1001A0008BB180638BB947D384E085BD5F9A579A42 +:1001B00027980895D4DF2FB7F8948EE991E09093B3 +:1001C0001F0280931E0290932102809320022FBF72 +:1001D0002FB7F89489E191E090939A018093990167 +:1001E00090939C0180939B012FBF7894CEE9D1E03E +:1001F0008C0183E0E82E9FB7F894809122029FBF84 +:10020000803801F180E091E060D697FD1BC0E0915D +:100210001E02F0911F02808380911E0290911F02A6 +:10022000019622E08E31920709F465C090931F0277 +:1002300080931E029FB7F894809122028F5F809373 +:1002400022029FBF8FB7F894F0909D018FBFA899AD +:1002500003C080E68F1520F5A89A80919D01882320 +:1002600019F05D98E0921601FA948FEFF81248C0E9 +:1002700080911601882341F080911601815080936E +:100280001601811101C05D9A80911701882341F008 +:1002900080911701815080931701811101C05C9AF0 +:1002A0009FB7F894809122029FBF8823F9F0E091D4 +:1002B0002002F0912102919122E0EE31F20709F43F +:1002C0003DC0F0932102E09320022FB7F894809173 +:1002D00022028150809322022FBF8091C80085FFA7 +:1002E000FCCF9093CE005C98E092170180E091E003 +:1002F000DED5D4D480CFD0931F02C0931E029ACFF4 +:10030000E0919B01F0919C01619121E0E939F207B4 +:1003100081F0F0939C01E0939B019FB7F89480914A +:100320009D01815080939D019FBF80E091E071D538 +:100330009BCF10939C0100939B01EFCFD0932102A0 +:10034000C0932002C2CF80E091E01FC580E091E021 +:10035000B7C40F931F93CF938C01FC018489C0E332 +:10036000813021F0C0E2823009F0C0E0F8018389D9 +:10037000823009F4C860F80185898730E9F1883056 +:10038000E9F1863009F4C2601092C9001092C800E9 +:100390001092CA00F80127853089418952892115B8 +:1003A000F1EE3F074105510559F1CA01B901969592 +:1003B00087957795679560587B47814E9F4FAFD55E +:1003C000215031093093CD002093CC00C093CA0056 +:1003D000F80187859089A189B2898115914EA1057F +:1003E000B10589F082E08093C80088E98093C90054 +:1003F000CF911F910F910895C460C6CFC660C4CF3E +:1004000020E130E0DFCF80E0EECF1F920F920FB6F9 +:100410000F9211242F938F939F93EF93FF938091CB +:10042000CE009EB39430D9F4E0919901F0919A01F5 +:100430008083E0919901F0919A01CF01019621E02A +:1004400089399207B1F090939A01809399019FB7EF +:10045000F89480919D018F5F80939D019FBFFF91D4 +:10046000EF919F918F912F910F900FBE0F901F9042 +:10047000189589E191E092838183E9CF23B1FC0152 +:10048000858580FF04C027FD02C05F9808955F9AAC +:100490000895292F33272230310571F0233031059B +:1004A00081F021303105A1F482E190E024E131E0D6 +:1004B000FA013183208308958EE390E026ED30E049 +:1004C000F7CF99278130910571F038F0029771F0DC +:1004D00090E080E030E020E0EBCFE2EDF0E08491CE +:1004E00090E09F01E5CFEEE9F0E0F9CFE4E7F0E03E +:1004F000F6CFAC0128E030E080E02417350718F093 +:100500008295807F08958F5F220F331FF6CF8093EF +:10051000E900EBEEF0E0808181608083EDEEF0E0B9 +:1005200010826093EC0040838091EE00881F882742 +:10053000881F08951092F40080E08093E9001092E3 +:10054000F0001092E8001092ED009091EB009E7F79 +:100550009093EB008F5F853081F70895809127029B +:1005600087FF11C08091E80082FF06C08091E800FB +:100570008B778093E80003C08EB38111F3CF089589 +:100580008EB38823E1F38091E80080FFF9CF80915A +:10059000E8008E77EECF85E69091EC0090FF06C0E4 +:1005A0009091E80090FF06C080E008959091E800E7 +:1005B00092FDFACF9EB39923A1F09EB3953099F0A6 +:1005C0009091EB0095FD11C09091E10092FFE4CF76 +:1005D0009091E1009B7F9093E1008150E9F684E0E7 +:1005E000089582E0089583E0089581E008952091C0 +:1005F0002D0230912E0226173707A0F061157105E4 +:1006000029F42091E8002E772093E80030E061156E +:10061000710551F4311108C08091E80082FF30C0AB +:1006200080E00895B901F2CF2091E80023FD30C0A9 +:100630002091E80022FDF0CF2EB3222359F12EB3F2 +:10064000253021F12091E80020FFE1CF2091F20038 +:10065000FC01CF016115710511F0283050F031E037 +:10066000283009F030E02091E8002E772093E80050 +:10067000CECF81918093F100615071092F5FE9CF56 +:100680008EB3882339F08EB3853031F683E0089538 +:1006900081E0089582E0089520912D0230912E028C +:1006A00026173707A0F06115710529F42091E8009D +:1006B0002E772093E80030E06115710551F4311177 +:1006C00008C08091E80082FF31C080E00895B90140 +:1006D000F2CF2091E80023FD31C02091E80022FDF7 +:1006E000F0CF2EB3222361F12EB3253029F12091D2 +:1006F000E80020FFE1CF2091F200FC01CF0161155D +:10070000710511F0283050F031E0283009F030E068 +:100710002091E8002E772093E800CECF849180933B +:10072000F100615071092F5F3196E8CF8EB38823B5 +:1007300039F08EB3853029F683E0089581E008957D +:1007400082E008956115710529F42091E8002B7766 +:100750002093E8006115710531F48091E80080FF75 +:1007600020C080E008952091E80023FD22C02EB330 +:10077000222309F12EB32530D1F02091E80022FF89 +:10078000E9CF2091F200222301F39C012F5F3F4F1C +:100790004091F100FC01408361507109C90189F762 +:1007A000D4CF8EB3882339F08EB38530B1F683E091 +:1007B000089581E0089582E0089542D044D01EBAA1 +:1007C00010922502109224021092230284E089BD27 +:1007D00089B5826089BD09B400FEFDCF8091D80043 +:1007E000982F9F779093D80080688093D80080914D +:1007F00063008E7F809363008091D8008F7D80930B +:10080000D8008091E0008E7F8093E0008091E1002D +:100810008E7F8093E1008091E20081608093E2000E +:100820008091E100877F8093E1008091E200886001 +:100830008093E2000895C1DF81E08093260208954D +:100840001092E20008951092E10008951F920F9215 +:100850000FB60F9211242F933F934F935F936F9393 +:100860007F938F939F93AF93BF93EF93FF93809169 +:10087000E10080FF1BC08091E20080FF17C08091E3 +:10088000E1008E7F8093E1008091E2008E7F809373 +:10089000E2008091E20080618093E2008091D800C4 +:1008A00080628093D80019BC1EBAF7D18091E10014 +:1008B00084FF27C08091E20084FF23C084E089BDCB +:1008C00089B5826089BD09B400FEFDCF8091D80052 +:1008D0008F7D8093D8008091E1008F7E8093E1002E +:1008E0008091E2008F7E8093E2008091E20081603F +:1008F0008093E2008091250281114DC081E08EBB82 +:10090000CCD18091E10083FF27C08091E20083FF7A +:1009100023C08091E100877F8093E10082E08EBB5D +:10092000109225028091E1008E7F8093E1008091FA +:10093000E2008E7F8093E2008091E20080618093EC +:10094000E200F8DD42E060E080E0E1DD8091F0006F +:1009500088608093F000A1D18091E10082FF0AC0FD +:100960008091E20082FF06C08091E1008B7F80933E +:10097000E10093D1FF91EF91BF91AF919F918F9142 +:100980007F916F915F914F913F912F910F900FBE8B +:100990000F901F90189584E0B2CF1F920F920FB660 +:1009A0000F921124FF920F931F932F933F934F9316 +:1009B0005F936F937F938F939F93AF93BF93CF93E7 +:1009C000DF93EF93FF93C9EED0E088818770F82E14 +:1009D000188200EF10E0F8018081877F808378948F +:1009E0001DD0F8941882F801808188608083F88295 +:1009F000FF91EF91DF91CF91BF91AF919F918F9137 +:100A00007F916F915F914F913F912F911F910F9126 +:100A1000FF900F900FBE0F901F9018951F93CF93CC +:100A2000DF93CDB7DEB7AA970FB6F894DEBF0FBE3F +:100A3000CDBFE7E2F2E08091F100819322E0EF3256 +:100A4000F207C9F780912702909128029A3008F0A6 +:100A500022C1E92FF0E0E25DFA4F83C238055D055F +:100A60004B065D054B06B805D4054B062606320637 +:100A7000803881F0823809F00EC180912B02877096 +:100A80008093E9008091EB0085FB882780F9109224 +:100A9000E90006C0809123029091240291118260A6 +:100AA0009091E800977F9093E8008093F100109276 +:100AB000F1008091E8008E772EC0282F2D7F09F05D +:100AC000EAC08823D1F0823051F18091E80083FFA1 +:100AD0000AC08091EB0080628093EB008091E80077 +:100AE000877F8093E800AA960FB6F894DEBF0FBE0A +:100AF000CDBFDF91CF911F91089580912902813060 +:100B000021F7933009F080E0809324021092E900ED +:100B10008091E800877F8093E80020DDD6CF809128 +:100B200029028111F3CF80912B02877071F280939B +:100B3000E9002091EB0020FFC8CF933031F4809181 +:100B4000EB0080628093EB00E1CF9091EB0090612D +:100B50009093EB0021E030E001C0220F8A95EAF784 +:100B60002093EA001092EA008091EB008860EACFBF +:100B7000811191C0109129028091E800877F8093B4 +:100B8000E800ECDC8091E80080FF0AC0812F8F77BD +:100B900092E009F093E09EBB80688093E30095CFDC +:100BA0008EB38111EFCF91CF8058823008F073C09F +:100BB0008091290290912A028C3D23E0920799F5B9 +:100BC00083E08A838AE289834FB7F894DE01139623 +:100BD00020E03EE051E2E32FF0E050935700E49133 +:100BE00020FF03C0E295EF703F5FEF7080E38E0F50 +:100BF0008A3310F087E38E0F90E08D939D932F5FE3 +:100C0000243149F74FBF8091E800877F8093E80047 +:100C10006AE270E0CE010196EADC8091E8008B7711 +:100C20008093E80052CFAE014F5F5F4F60912B027F +:100C300030DCBC01892B09F448CF9091E800977F04 +:100C40009093E80089819A8127DDE7CF803819F5F4 +:100C50008091E800877F8093E8008091250280934F +:100C6000F10027CF811117C090912902923008F02E +:100C70002CCF8091E800877F8093E8009093250235 +:100C80006DDC80912502811104C083E08EBB5BDBAB +:100C90001CCF84E0FBCF5ADB18CF0895CF938EB3DF +:100CA000882359F0C091E900C7701092E900809143 +:100CB000E80083FDB3DEC093E900CF910895089565 +:100CC000CF93DF93EC018091E80083FF0FC0288170 +:100CD00080912B0290912C022817190639F48091EB +:100CE00028028132C1F028F4803249F1DF91CF919E +:100CF00008958232C1F18332C9F78091270281328F +:100D0000A9F78091E800877F8093E800609129022D +:100D1000CE01D5DF37C080912702813A39F7809123 +:100D2000E800877F8093E80067E070E0CE010F96CF +:100D30005EDC8091E8008B778093E800D7CF8091CC +:100D40002702813299F68091E800877F8093E8003E +:100D500067E070E0CE010F96F5DCCE01FADA809103 +:100D6000E8008E77E9CF80912702813209F0BECF6B +:100D70008091E800877F8093E800809129028D8729 +:100D8000CE017CDBDF91CF91E9CB0F931F93CF9303 +:100D9000DF93EC01FC013D9689E0DF011D928A950D +:100DA000E9F78A819B812C8110E0211114E00981EF +:100DB000A0DB812B482F426061E8802FA8DB8823CD +:100DC00011F18E819F81288510E0211114E00D81A1 +:100DD00090DB812B482F426060E8802F98DB8823CE +:100DE00091F08A859B852C8510E0211114E0C9853E +:100DF00080DB812B482F426061EC8C2FDF91CF91FB +:100E00001F910F9184CB80E0DF91CF911F910F91C3 +:100E10000895CF93C62F2EB32430F1F4FC014785FB +:100E2000508961897289452B462B472BA9F0818116 +:100E30008093E9008091E80085FF05C0C093F10030 +:100E400080E0CF9108958091E8008E778093E8004C +:100E5000A2DB882399F3F5CF82E0F3CF2EB32430C1 +:100E600021F5FC014785508961897289452B462B04 +:100E7000472BD9F081818093E9008091F2008111A4 +:100E800002C080E008959091E8008091E8008E779C +:100E90008093E80095FDF5CF7EDB811107C090912E +:100EA000E8009E779093E800089582E008952EB3BD +:100EB000243051F4FC014785508961897289452BA2 +:100EC000462B472B09F0CACF08952EB3243019F0D2 +:100ED0008FEF9FEF0895FC014785508961897289E2 +:100EE000452B462B472BA1F385818093E900809108 +:100EF000E80082FFEDCF8091F200882369F08091B5 +:100F0000F10090E02091F200211105C02091E8004D +:100F10002B772093E80008958FEF9FEFF3CFA1E2A6 +:100F20001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F63 +:100F3000FF1FA217B307E407F50720F0A21BB30BAE +:100F4000E40BF50B661F771F881F991F1A9469F72A +:100F500060957095809590959B01AC01BD01CF0186 +:100F60000895EE0FFF1F0590F491E02D0994F89479 +:020F7000FFCFB1 +:100F720000034000000440000002080000000000DE +:060F820000000000000069 +:00000001FF From 6d0e93bc58a54c4a6c862b8a0ae983f751ce0203 Mon Sep 17 00:00:00 2001 From: Murray Date: Sun, 7 Jan 2018 18:54:45 -0600 Subject: [PATCH 04/12] display a different message on U command if reset control is disabled --- speeduino/comms.ino | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/speeduino/comms.ino b/speeduino/comms.ino index 749ac9f0..4209f630 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -184,12 +184,21 @@ void command() break; case 'U': //User wants to reset the Arduino (probably for FW update) - #ifndef SMALL_FLASH_MODE - if (!cmdPending) { Serial.println(F("Comms halted. Next byte will reset the Arduino.")); } - #endif + if (resetControl != RESET_CONTROL_DISABLED) + { + #ifndef SMALL_FLASH_MODE + if (!cmdPending) { Serial.println(F("Comms halted. Next byte will reset the Arduino.")); } + #endif - while (Serial.available() == 0) { } - digitalWrite(pinResetControl, LOW); + while (Serial.available() == 0) { } + digitalWrite(pinResetControl, LOW); + } + else + { + #ifndef SMALL_FLASH_MODE + if (!cmdPending) { Serial.println(F("Reset control is currently disabled.")); } + #endif + } break; case 'V': // send VE table and constants in binary From 2819adb8654023aa9816f762965b3df83233d859 Mon Sep 17 00:00:00 2001 From: Murray Date: Fri, 12 Jan 2018 21:37:21 -0600 Subject: [PATCH 05/12] Custom bootloader recognition Added a new serial command that allows a custom 16u2 firmware to let the speeduino know about itself. After issuing a `, the speeduino will expect one more byte indicating the capabilities level of the custom firmware (only 1 for now). --- reference/speeduino.ini | 7 ++++++- speeduino/comms.ino | 11 +++++++++++ speeduino/globals.h | 5 ++--- speeduino/speeduino.ino | 4 ++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index de2642a8..42f4a080 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -281,7 +281,7 @@ page = 4 useResync = bits, U08, 6,[7:7], "No", "Yes" sparkDur = scalar, U08, 7, "ms", 0.1, 0, 0, 25.5, 1 ; Spark duration unused4-8 = scalar, U08, 8, "ms", 0.1, 0.0, 0.0, 25.5, 1 - unused4-9 = scalar, U08, 9, "ms", 0.1, 0.0, 0.0, 25.5, 1 + bootloaderCaps = scalar, U08, 9, "level", 1, 0, 0, 255, 0 resetControl = bits, U08, 10,[0:1], "Disabled", "Prevent When Running", "Prevent Always", "Serial Command" resetControlPin = bits, U08, 10,[2:7], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" SkipCycles = scalar, U08, 11, "cycles", 1, 0, 0, 255, 0 @@ -805,6 +805,7 @@ page = 10 defaultValue = VVTasOnOff, 0 defaultValue = stagingEnabled, 0 defaultValue = resetControl, 0 + defaultValue = bootloaderCaps, 0 ; defaultValue = obd_address, 0 ;Default pins @@ -816,6 +817,9 @@ page = 10 defaultValue = tachoPin, 0 defaultValue = perToothIgn, 0 defaultValue = resetControlPin, 0 + + controllerPriority = bootloaderCaps + [Menu] ;---------------------------------------------------------------------------- @@ -2243,6 +2247,7 @@ cmdtestspk450dc = "E\x03\x0C" indicator = { boostCutOut }, "Ign Cut OFF", "Ign Cut (Boost)", white, black, red, black indicator = { sync }, "No Sync", "Sync", white, black, green, black indicator = { resetLockOn }, "Reset Lock OFF","Reset Lock ON", red, black, green, black + indicator = { bootloaderCaps > 0 }, "Std. Boot", "Custom Boot", white, black, white, black ;------------------------------------------------------------------------------- diff --git a/speeduino/comms.ino b/speeduino/comms.ino index 05c780e3..c90f84d6 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -311,6 +311,17 @@ void command() sendToothLog(true); //Sends tooth log values as chars break; + case '`': //Custom 16u2 firmware is making its presence known + cmdPending = true; + + if (Serial.available() >= 1) { + //configPage2.bootloaderCaps = Serial.read(); + configPage2.bootloaderCaps = 0; + cmdPending = false; + } + break; + + case '?': #ifndef SMALL_FLASH_MODE Serial.println diff --git a/speeduino/globals.h b/speeduino/globals.h index 1f527b16..a4253352 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -446,9 +446,8 @@ struct config2 { byte sparkDur; //Spark duration in ms * 10 byte unused4_8; - byte unused4_9; - - //byte unused4_10; + uint8_t bootloaderCaps; //Capabilities of the bootloader over stock. e.g., 0=Stock, 1=Reset protection, etc. + byte resetControl : 2; //Which method of reset control to use (0=None, 1=Prevent When Running, 2=Prevent Always, 3=Serial Command) byte resetControlPin : 6; diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 1ede7602..204a8e14 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -147,6 +147,10 @@ void setup() loadConfig(); doUpdates(); //Check if any data items need updating (Occurs ith firmware updates) + //Always start with a clean slate on the bootloader capabilities level + //This should be 0 until we hear otherwise from the 16u2 + configPage2.bootloaderCaps = 0; + Serial.begin(115200); #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 if (configPage10.enable_canbus == 1) { CANSerial.begin(115200); } From 35267f21edf8f3a235d5d58d60df6a5ef1ab9518 Mon Sep 17 00:00:00 2001 From: Murray Date: Sat, 13 Jan 2018 09:06:12 -0600 Subject: [PATCH 06/12] Updated bootloader that sends its version to Speeduino when TS connects --- ...ino-usbserial-atmega16u2-Mega2560-Rev3.hex | 454 ++++++++---------- 1 file changed, 204 insertions(+), 250 deletions(-) diff --git a/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex index 3eb3d71c..17db493b 100644 --- a/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex +++ b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex @@ -1,251 +1,205 @@ -:1000000092C00000ABC00000A9C00000A7C0000063 -:10001000A5C00000A3C00000A1C000009FC0000058 -:100020009DC000009BC0000099C000000FC40000EC -:10003000B4C4000093C0000091C000008FC0000055 -:100040008DC000008BC0000089C0000087C0000088 -:1000500085C0000083C0000081C00000D6C1000040 -:100060007DC000007BC0000079C0000077C00000A8 -:1000700075C000002803530070006500650064002F -:10008000750069006E006F0020004D00650067007C -:1000900061002000320035003600300000003203DD -:1000A000410072006400750069006E006F0020005E -:1000B00028007700770077002E006100720064004E -:1000C000750069006E006F002E0063006300290058 -:1000D00000000403090409023E00020100C03209C5 -:1000E00004000001020201000524000110042402A2 -:1000F000060524060001070582030800FF09040124 -:1001000000020A0000000705040240000107058301 -:10011000024000011201100102000008EB034B2015 -:1001200001000102DC0111241FBECFEFD2E0DEBFCF -:10013000CDBF11E0A0E0B1E0E2E7FFE002C0059032 -:100140000D92A631B107D9F722E0A6E1B1E001C0D6 -:100150001D92AF32B207E1F72DD009C751CF84B756 -:10016000877F84BF0FB6F894A8958091600088615E -:1001700080936000109260000FBE87E690E090933D -:10018000CD008093CC0086E08093CA001092C80016 -:1001900088E18093C900539A5A9A8AB180638AB9D8 -:1001A0008BB180638BB947D384E085BD5F9A579A42 -:1001B00027980895D4DF2FB7F8948EE991E09093B3 -:1001C0001F0280931E0290932102809320022FBF72 -:1001D0002FB7F89489E191E090939A018093990167 -:1001E00090939C0180939B012FBF7894CEE9D1E03E -:1001F0008C0183E0E82E9FB7F894809122029FBF84 -:10020000803801F180E091E060D697FD1BC0E0915D -:100210001E02F0911F02808380911E0290911F02A6 -:10022000019622E08E31920709F465C090931F0277 -:1002300080931E029FB7F894809122028F5F809373 -:1002400022029FBF8FB7F894F0909D018FBFA899AD -:1002500003C080E68F1520F5A89A80919D01882320 -:1002600019F05D98E0921601FA948FEFF81248C0E9 -:1002700080911601882341F080911601815080936E -:100280001601811101C05D9A80911701882341F008 -:1002900080911701815080931701811101C05C9AF0 -:1002A0009FB7F894809122029FBF8823F9F0E091D4 -:1002B0002002F0912102919122E0EE31F20709F43F -:1002C0003DC0F0932102E09320022FB7F894809173 -:1002D00022028150809322022FBF8091C80085FFA7 -:1002E000FCCF9093CE005C98E092170180E091E003 -:1002F000DED5D4D480CFD0931F02C0931E029ACFF4 -:10030000E0919B01F0919C01619121E0E939F207B4 -:1003100081F0F0939C01E0939B019FB7F89480914A -:100320009D01815080939D019FBF80E091E071D538 -:100330009BCF10939C0100939B01EFCFD0932102A0 -:10034000C0932002C2CF80E091E01FC580E091E021 -:10035000B7C40F931F93CF938C01FC018489C0E332 -:10036000813021F0C0E2823009F0C0E0F8018389D9 -:10037000823009F4C860F80185898730E9F1883056 -:10038000E9F1863009F4C2601092C9001092C800E9 -:100390001092CA00F80127853089418952892115B8 -:1003A000F1EE3F074105510559F1CA01B901969592 -:1003B00087957795679560587B47814E9F4FAFD55E -:1003C000215031093093CD002093CC00C093CA0056 -:1003D000F80187859089A189B2898115914EA1057F -:1003E000B10589F082E08093C80088E98093C90054 -:1003F000CF911F910F910895C460C6CFC660C4CF3E -:1004000020E130E0DFCF80E0EECF1F920F920FB6F9 -:100410000F9211242F938F939F93EF93FF938091CB -:10042000CE009EB39430D9F4E0919901F0919A01F5 -:100430008083E0919901F0919A01CF01019621E02A -:1004400089399207B1F090939A01809399019FB7EF -:10045000F89480919D018F5F80939D019FBFFF91D4 -:10046000EF919F918F912F910F900FBE0F901F9042 -:10047000189589E191E092838183E9CF23B1FC0152 -:10048000858580FF04C027FD02C05F9808955F9AAC -:100490000895292F33272230310571F0233031059B -:1004A00081F021303105A1F482E190E024E131E0D6 -:1004B000FA013183208308958EE390E026ED30E049 -:1004C000F7CF99278130910571F038F0029771F0DC -:1004D00090E080E030E020E0EBCFE2EDF0E08491CE -:1004E00090E09F01E5CFEEE9F0E0F9CFE4E7F0E03E -:1004F000F6CFAC0128E030E080E02417350718F093 -:100500008295807F08958F5F220F331FF6CF8093EF -:10051000E900EBEEF0E0808181608083EDEEF0E0B9 -:1005200010826093EC0040838091EE00881F882742 -:10053000881F08951092F40080E08093E9001092E3 -:10054000F0001092E8001092ED009091EB009E7F79 -:100550009093EB008F5F853081F70895809127029B -:1005600087FF11C08091E80082FF06C08091E800FB -:100570008B778093E80003C08EB38111F3CF089589 -:100580008EB38823E1F38091E80080FFF9CF80915A -:10059000E8008E77EECF85E69091EC0090FF06C0E4 -:1005A0009091E80090FF06C080E008959091E800E7 -:1005B00092FDFACF9EB39923A1F09EB3953099F0A6 -:1005C0009091EB0095FD11C09091E10092FFE4CF76 -:1005D0009091E1009B7F9093E1008150E9F684E0E7 -:1005E000089582E0089583E0089581E008952091C0 -:1005F0002D0230912E0226173707A0F061157105E4 -:1006000029F42091E8002E772093E80030E061156E -:10061000710551F4311108C08091E80082FF30C0AB -:1006200080E00895B901F2CF2091E80023FD30C0A9 -:100630002091E80022FDF0CF2EB3222359F12EB3F2 -:10064000253021F12091E80020FFE1CF2091F20038 -:10065000FC01CF016115710511F0283050F031E037 -:10066000283009F030E02091E8002E772093E80050 -:10067000CECF81918093F100615071092F5FE9CF56 -:100680008EB3882339F08EB3853031F683E0089538 -:1006900081E0089582E0089520912D0230912E028C -:1006A00026173707A0F06115710529F42091E8009D -:1006B0002E772093E80030E06115710551F4311177 -:1006C00008C08091E80082FF31C080E00895B90140 -:1006D000F2CF2091E80023FD31C02091E80022FDF7 -:1006E000F0CF2EB3222361F12EB3253029F12091D2 -:1006F000E80020FFE1CF2091F200FC01CF0161155D -:10070000710511F0283050F031E0283009F030E068 -:100710002091E8002E772093E800CECF849180933B -:10072000F100615071092F5F3196E8CF8EB38823B5 -:1007300039F08EB3853029F683E0089581E008957D -:1007400082E008956115710529F42091E8002B7766 -:100750002093E8006115710531F48091E80080FF75 -:1007600020C080E008952091E80023FD22C02EB330 -:10077000222309F12EB32530D1F02091E80022FF89 -:10078000E9CF2091F200222301F39C012F5F3F4F1C -:100790004091F100FC01408361507109C90189F762 -:1007A000D4CF8EB3882339F08EB38530B1F683E091 -:1007B000089581E0089582E0089542D044D01EBAA1 -:1007C00010922502109224021092230284E089BD27 -:1007D00089B5826089BD09B400FEFDCF8091D80043 -:1007E000982F9F779093D80080688093D80080914D -:1007F00063008E7F809363008091D8008F7D80930B -:10080000D8008091E0008E7F8093E0008091E1002D -:100810008E7F8093E1008091E20081608093E2000E -:100820008091E100877F8093E1008091E200886001 -:100830008093E2000895C1DF81E08093260208954D -:100840001092E20008951092E10008951F920F9215 -:100850000FB60F9211242F933F934F935F936F9393 -:100860007F938F939F93AF93BF93EF93FF93809169 -:10087000E10080FF1BC08091E20080FF17C08091E3 -:10088000E1008E7F8093E1008091E2008E7F809373 -:10089000E2008091E20080618093E2008091D800C4 -:1008A00080628093D80019BC1EBAF7D18091E10014 -:1008B00084FF27C08091E20084FF23C084E089BDCB -:1008C00089B5826089BD09B400FEFDCF8091D80052 -:1008D0008F7D8093D8008091E1008F7E8093E1002E -:1008E0008091E2008F7E8093E2008091E20081603F -:1008F0008093E2008091250281114DC081E08EBB82 -:10090000CCD18091E10083FF27C08091E20083FF7A -:1009100023C08091E100877F8093E10082E08EBB5D -:10092000109225028091E1008E7F8093E1008091FA -:10093000E2008E7F8093E2008091E20080618093EC -:10094000E200F8DD42E060E080E0E1DD8091F0006F -:1009500088608093F000A1D18091E10082FF0AC0FD -:100960008091E20082FF06C08091E1008B7F80933E -:10097000E10093D1FF91EF91BF91AF919F918F9142 -:100980007F916F915F914F913F912F910F900FBE8B -:100990000F901F90189584E0B2CF1F920F920FB660 -:1009A0000F921124FF920F931F932F933F934F9316 -:1009B0005F936F937F938F939F93AF93BF93CF93E7 -:1009C000DF93EF93FF93C9EED0E088818770F82E14 -:1009D000188200EF10E0F8018081877F808378948F -:1009E0001DD0F8941882F801808188608083F88295 -:1009F000FF91EF91DF91CF91BF91AF919F918F9137 -:100A00007F916F915F914F913F912F911F910F9126 -:100A1000FF900F900FBE0F901F9018951F93CF93CC -:100A2000DF93CDB7DEB7AA970FB6F894DEBF0FBE3F -:100A3000CDBFE7E2F2E08091F100819322E0EF3256 -:100A4000F207C9F780912702909128029A3008F0A6 -:100A500022C1E92FF0E0E25DFA4F83C238055D055F -:100A60004B065D054B06B805D4054B062606320637 -:100A7000803881F0823809F00EC180912B02877096 -:100A80008093E9008091EB0085FB882780F9109224 -:100A9000E90006C0809123029091240291118260A6 -:100AA0009091E800977F9093E8008093F100109276 -:100AB000F1008091E8008E772EC0282F2D7F09F05D -:100AC000EAC08823D1F0823051F18091E80083FFA1 -:100AD0000AC08091EB0080628093EB008091E80077 -:100AE000877F8093E800AA960FB6F894DEBF0FBE0A -:100AF000CDBFDF91CF911F91089580912902813060 -:100B000021F7933009F080E0809324021092E900ED -:100B10008091E800877F8093E80020DDD6CF809128 -:100B200029028111F3CF80912B02877071F280939B -:100B3000E9002091EB0020FFC8CF933031F4809181 -:100B4000EB0080628093EB00E1CF9091EB0090612D -:100B50009093EB0021E030E001C0220F8A95EAF784 -:100B60002093EA001092EA008091EB008860EACFBF -:100B7000811191C0109129028091E800877F8093B4 -:100B8000E800ECDC8091E80080FF0AC0812F8F77BD -:100B900092E009F093E09EBB80688093E30095CFDC -:100BA0008EB38111EFCF91CF8058823008F073C09F -:100BB0008091290290912A028C3D23E0920799F5B9 -:100BC00083E08A838AE289834FB7F894DE01139623 -:100BD00020E03EE051E2E32FF0E050935700E49133 -:100BE00020FF03C0E295EF703F5FEF7080E38E0F50 -:100BF0008A3310F087E38E0F90E08D939D932F5FE3 -:100C0000243149F74FBF8091E800877F8093E80047 -:100C10006AE270E0CE010196EADC8091E8008B7711 -:100C20008093E80052CFAE014F5F5F4F60912B027F -:100C300030DCBC01892B09F448CF9091E800977F04 -:100C40009093E80089819A8127DDE7CF803819F5F4 -:100C50008091E800877F8093E8008091250280934F -:100C6000F10027CF811117C090912902923008F02E -:100C70002CCF8091E800877F8093E8009093250235 -:100C80006DDC80912502811104C083E08EBB5BDBAB -:100C90001CCF84E0FBCF5ADB18CF0895CF938EB3DF -:100CA000882359F0C091E900C7701092E900809143 -:100CB000E80083FDB3DEC093E900CF910895089565 -:100CC000CF93DF93EC018091E80083FF0FC0288170 -:100CD00080912B0290912C022817190639F48091EB -:100CE00028028132C1F028F4803249F1DF91CF919E -:100CF00008958232C1F18332C9F78091270281328F -:100D0000A9F78091E800877F8093E800609129022D -:100D1000CE01D5DF37C080912702813A39F7809123 -:100D2000E800877F8093E80067E070E0CE010F96CF -:100D30005EDC8091E8008B778093E800D7CF8091CC -:100D40002702813299F68091E800877F8093E8003E -:100D500067E070E0CE010F96F5DCCE01FADA809103 -:100D6000E8008E77E9CF80912702813209F0BECF6B -:100D70008091E800877F8093E800809129028D8729 -:100D8000CE017CDBDF91CF91E9CB0F931F93CF9303 -:100D9000DF93EC01FC013D9689E0DF011D928A950D -:100DA000E9F78A819B812C8110E0211114E00981EF -:100DB000A0DB812B482F426061E8802FA8DB8823CD -:100DC00011F18E819F81288510E0211114E00D81A1 -:100DD00090DB812B482F426060E8802F98DB8823CE -:100DE00091F08A859B852C8510E0211114E0C9853E -:100DF00080DB812B482F426061EC8C2FDF91CF91FB -:100E00001F910F9184CB80E0DF91CF911F910F91C3 -:100E10000895CF93C62F2EB32430F1F4FC014785FB -:100E2000508961897289452B462B472BA9F0818116 -:100E30008093E9008091E80085FF05C0C093F10030 -:100E400080E0CF9108958091E8008E778093E8004C -:100E5000A2DB882399F3F5CF82E0F3CF2EB32430C1 -:100E600021F5FC014785508961897289452B462B04 -:100E7000472BD9F081818093E9008091F2008111A4 -:100E800002C080E008959091E8008091E8008E779C -:100E90008093E80095FDF5CF7EDB811107C090912E -:100EA000E8009E779093E800089582E008952EB3BD -:100EB000243051F4FC014785508961897289452BA2 -:100EC000462B472B09F0CACF08952EB3243019F0D2 -:100ED0008FEF9FEF0895FC014785508961897289E2 -:100EE000452B462B472BA1F385818093E900809108 -:100EF000E80082FFEDCF8091F200882369F08091B5 -:100F0000F10090E02091F200211105C02091E8004D -:100F10002B772093E80008958FEF9FEFF3CFA1E2A6 -:100F20001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F63 -:100F3000FF1FA217B307E407F50720F0A21BB30BAE -:100F4000E40BF50B661F771F881F991F1A9469F72A -:100F500060957095809590959B01AC01BD01CF0186 -:100F60000895EE0FFF1F0590F491E02D0994F89479 -:020F7000FFCFB1 -:100F720000034000000440000002080000000000DE -:060F820000000000000069 +:1010000039C0000052C0000050C000004EC00000B7 +:101010004CC000004AC0000048C0000046C00000AC +:1010200044C0000042C0000040C000009AC400005C +:101030003CC000003AC0000038C0000036C00000CC +:1010400034C0000032C0000030C000002EC00000DC +:101050002CC000002AC0000028C0000026C00000EC +:1010600024C0000022C0000020C000001EC00000FC +:101070001CC0000011241FBECFEFD2E0DEBFCDBFE9 +:1010800011E0A0E0B1E0E0E4FCE102C005900D92C7 +:10109000A836B107D9F721E0A8E6B1E001C01D925A +:1010A000A738B207E1F726D1C9C5AACF815080F091 +:1010B0009091F20091110DC09091E8009B7F909368 +:1010C000E8009091E80092FDF1CF9EB39111F9CF25 +:1010D00008959091F100EACFE1E7F1E035812481B4 +:1010E0009381828190936A0180936B01C9019093EF +:1010F0006801809369010895CF93DF9300D000D0F9 +:1011000000D0CDB7DEB780917101843009F45CC0A6 +:1011100068F48130E9F08330A1F126960FB6F89497 +:10112000DEBF0FBECDBFDF91CF910895853009F4AA +:1011300098C0863091F780917201833071F7809169 +:1011400073018111EACF8091740180936C01E5CF26 +:1011500080917201823008F7BFDF809172018111A6 +:101160000CC080916A0190916B0123E0FC012093F7 +:101170005700E89507B600FCFDCF85E0809300019D +:10118000CCCF80917201982F9D7F19F4A5DF89E063 +:10119000F5CF813009F0C1CFF0E0E0E084918F3FDE +:1011A00069F010926C01F0936B01E0936A018AE0A0 +:1011B0008093000185E080936F01AFCF3196E115F8 +:1011C00020E1F20759F7A9CF80917201833039F5F8 +:1011D00081E08093700180917301209177013091BB +:1011E0007801232B61F0813009F097CF909176013F +:1011F0008091750190936D0180936E018ECF811166 +:101200000BC088E19CE00FB6F894A895809360002D +:101210000FBE9093600081CF109201017ECF8111AB +:101220007CCF809173018F3F09F077CFF0E0E0E051 +:1012300083E095E080935700E89507B600FCFDCF6A +:1012400090935700E89507B600FCFDCFE058FF4F9C +:10125000E11520E1F20771F781E180935700E895ED +:101260005CCF8091610190916201A09163018C83B8 +:101270009D83AE838091640190916501A091660188 +:1012800089839A83AB83E09173018091720181110C +:1012900007C0EC0FFD2FF11D848180937C013DCFB1 +:1012A000813009F03ACF81ED9FEF8C0F9D1F8E0F9B +:1012B000911DFC018081F1CF84B7877F84BF0FB679 +:1012C000F894A895809160008861809360001092E6 +:1012D00060000FBE81E085BF82E085BF8AB1806378 +:1012E0008AB98BB180638BB91BC31FD381E085BFE3 +:1012F00015BE0895E1DF78948091010181110AC043 +:1013000080917001811106C0F0DFE0916D01F091D4 +:101310006E0109956FD4F0CF7F928F929F92AF921A +:10132000BF92CF92DF92EF92FF920F931F93CF93D2 +:10133000DF9380918501909186019093780180934D +:10134000770180917901882341F080917901815062 +:1013500080937901811101C05D9A80917A0188237F +:1013600041F080917A01815080937A01811101C00E +:101370005C9A80918001833009F4B6C198F4813081 +:1013800019F1823009F41FC1DF91CF911F910F91A4 +:10139000FF90EF90DF90CF90BF90AF909F908F9095 +:1013A0007F900895853009F4BDC108F4B3C186303B +:1013B00059F78091E800877F8093E8005D9A5C9AF6 +:1013C00082E0809300012BC05C9883E080937A01D7 +:1013D0008091E800877F8093E800809170018823E6 +:1013E00029F08ADE5D9A5C9A1092700180917701F3 +:1013F00090917801009729F580910001853051F492 +:101400008091770190917801892B09F03FC082E0AB +:10141000809300018091E8008B7F8093E800DF914A +:10142000CF911F910F91FF90EF90DF90CF90BF90E1 +:10143000AF909F908F907F90C7C12EB3222309F465 +:10144000A3CF2091E80022FFF8CF2091F100209354 +:10145000710101979093780180937701E2E7F1E0C1 +:101460008091F200882381F08091F1008193809136 +:10147000770190917801019790937801809377019B +:1014800021E0E737F20761F737DEB6CF8AE10EDEFB +:1014900080916A018F710ADE20916A0130916B019F +:1014A000C0916801D09169012196C21BD30B809134 +:1014B0007201811178C0D695C795C90120916C0140 +:1014C000A22FB0E04C0120E011E005E033E0732EE4 +:1014D000AE0141505109CD2B79F480916801909172 +:1014E000690190936B0180936A0181E180935700B9 +:1014F000E89580E1DBDD8ECF3091F200332361F19E +:10150000E091F1003091F1006E2F732FFC010B017F +:1015100010935700E89511242F5F6C017D01F2E0D4 +:10152000CF0ED11CE11CF11CD701C601203409F5F6 +:10153000F40100935700E89507B600FCFDCF411574 +:101540005105D1F0F60170925700E89507B600FCFE +:10155000FDCF20E0460110C03091E8003B7F309382 +:10156000E8003091E80032FDCBCF3EB33111F9CF26 +:101570000BCF41155105E1F2EA01AACF8091F200AB +:101580008823A1F021976091F10080916A019091E8 +:101590006B0146D380916A0190916B010196909303 +:1015A0006B0180936A01209749F7A3CF8091E800EF +:1015B0008B7F8093E8008091E80082FDE3CF8EB3BB +:1015C0008111F9CFE1CE8091E800877F8093E80018 +:1015D0005D9883E0809379018091E80080FF16C0D8 +:1015E000809100018930C9F08A30A1F480917201A4 +:1015F000813081F490916A0180916B019093F100A8 +:101600008093F1008091E8008E7F07CF8EB3811127 +:10161000E3CFBACE80917C01F3CF20916A01309163 +:101620006B01C0916801D09169012196C21BD30B57 +:1016300080917201811131C0D695C795C901209161 +:101640006C01A22FB0E0219760F480916801909125 +:10165000690190936B0180936A0182E0809300019D +:10166000D1CF2091F200203259F0FC012591349124 +:101670002093F1003093F1000296A11DB11DE3CF3C +:101680002091E8002E7F2093E8002091E80020FDC3 +:10169000ECCF2EB32111F9CF77CE8230F1F620971F +:1016A000E1F28091F200803291F080916A01909194 +:1016B0006B01AED28093F10080916A0190916B0131 +:1016C000019690936B0180936A012197E8CF8091F6 +:1016D000E8008E7F8093E8008091E80080FDE5CFF0 +:1016E0008EB38111F9CF50CE8091E800877F80932F +:1016F000E80080916F018093F1001092F100109248 +:10170000F1001092F100809100018093F10010929D +:10171000F10078CF8091E800877F8093E8001092F5 +:101720006F017DCE8091E800877F8093E8008091F3 +:10173000000166CF292F30E02230310571F02330CF +:10174000310581F021303105D9F482E190E02FE4B8 +:1017500031E0FA013183208308958BE190E024E3A6 +:1017600031E0F7CF811106C08091300190E020E395 +:1017700031E0EFCF8091020190E022E031E0E9CF4B +:1017800090E080E030E020E0E4CFEBEEF0E080811C +:1017900081608083EDEEF0E010826093EC00408386 +:1017A0008091EE00881F8827881F08951092F4000A +:1017B0001092F0001092E8001092ED00EBEEF0E0D5 +:1017C00080818E7F8083089580917F0187FF11C083 +:1017D0008091E80082FF06C08091E8008B7F8093B3 +:1017E000E80003C08EB38111F3CF08958EB3882330 +:1017F000E1F38091E80080FFF9CF8091E8008E7FCF +:10180000EECF209185013091860126173707A0F091 +:101810006115710529F42091E8002E7F2093E800DE +:1018200030E06115710551F4311108C08091E80074 +:1018300082FF30C080E00895B901F2CF2091E80026 +:1018400023FD30C02091E80022FDF0CF2EB32223EB +:1018500059F12EB3253021F12091E80020FFE1CF8E +:101860002091F200FC01CF016115710511F02032C9 +:1018700050F031E0203209F030E02091E8002E7F76 +:101880002093E800CECF81918093F10061507109DF +:101890002F5FE9CF8EB3882339F08EB3853031F6D0 +:1018A00083E0089581E0089582E0089554D056D0F1 +:1018B0001EBA10927D0184E089BD89B5826089BD20 +:1018C00009B400FEFDCF8091D800982F9F779093A8 +:1018D000D80080688093D800809163008E7F8093C9 +:1018E00063008091D8008F7D8093D8008091E000C4 +:1018F0008E7F8093E0008091E1008E7F8093E100F5 +:101900008091E20081608093E2008091E100877F16 +:101910008093E1008091E20088608093E200089566 +:10192000C5DF81E080937E010895C0DFE0EEF0E046 +:10193000808181608083E8EDF0E080818F77808313 +:101940000AD00CD019BCE3E6F0E08081816080838E +:1019500010927E0108951092E20008951092E10025 +:1019600008951F920F920FB60F9211242F933F9359 +:101970004F935F936F937F938F939F93AF93BF9397 +:10198000EF93FF938091E10080FF1BC08091E20004 +:1019900080FF17C08091E1008E7F8093E1008091ED +:1019A000E2008E7F8093E2008091E200806180936C +:1019B000E2008091D80080628093D80019BC1EBAE2 +:1019C00018D18091E10084FF27C08091E20084FF5C +:1019D00023C084E089BD89B5826089BD09B400FE59 +:1019E000FDCF8091D8008F7D8093D8008091E10059 +:1019F0008F7E8093E1008091E2008F7E8093E200F1 +:101A00008091E20081608093E20080917D018111EC +:101A100048C081E08EBBEDD08091E10083FF22C001 +:101A20008091E20083FF1EC08091E100877F809358 +:101A3000E10082E08EBB10927D018091E1008E7FFB +:101A40008093E1008091E2008E7F8093E20080919C +:101A5000E20080618093E200A9DE42E260E080E083 +:101A600094DEC7D08091E10082FF0AC08091E2003D +:101A700082FF06C08091E1008B7F8093E100B9D0A6 +:101A8000FF91EF91BF91AF919F918F917F916F9156 +:101A90005F914F913F912F910F900FBE0F901F902C +:101AA000189584E0B7CF1F93CF93DF9300D0CDB7C5 +:101AB000DEB7EFE7F1E087E891E02091F1002193B4 +:101AC0008E179F07D1F780917F01E0918001EA3066 +:101AD00038F5F0E0E359F24F95C0770D8E0D900D7B +:101AE0008E0D900D920DAE0D900DCD0DE00D8D7FF4 +:101AF0008038B1F48091E80083FF0AC08091EB0048 +:101B000080628093EB008091E800877F8093E800FB +:101B10000F900F90DF91CF911F9108958D7F51F31A +:101B2000FBDBE8CF8111FCCF109181018091E800AF +:101B3000877F8093E80048DE8091E80080FF0AC03C +:101B4000812F8F7792E009F093E09EBB80688093AD +:101B5000E300D0CF8EB38111EFCFCCCF805882304D +:101B6000F8F6AE014F5F5F4F609183018091810174 +:101B700090918201DFDDBC01892B09F4BBCF9091EC +:101B8000E800977F9093E80089819A813ADE8091FE +:101B9000E8008B7F8093E800ADCF803809F0C0CF9C +:101BA0008091E800877F8093E80080917D01809399 +:101BB000F1008091E8008E7F8093E80005DE9ACFE7 +:101BC0008111AECF90918101923008F093CF809136 +:101BD000E800877F8093E80090937D01F5DD809198 +:101BE0007D01811104C083E08EBB03D083CF84E0EC +:101BF000FBCF08958EB3882321F08091E80083FD08 +:101C000052CF0895EE0FFF1F0590F491E02D099437 +:101C1000F999FECF92BD81BDF89A992780B50895B4 +:101C2000262FF999FECF1FBA92BD81BD20BD0FB6F8 +:101C3000F894FA9AF99A0FBE01960895F894FFCF96 +:101C400002012C03410072006400750069006E00FF +:101C50006F0020004D006500670061002000320029 +:101C600035003600300020004400460055000000DA +:101C70000403090409021B00010100803209040069 +:101C80000000FE0102000921030000000C00011207 +:101C900001100100000020EB03EF2F000000010005 +:081CA0000120DCFB1E94890009 +:0400000300001000E9 :00000001FF From bd303bd767a4561a3ba8483c3e800ba6fa378a56 Mon Sep 17 00:00:00 2001 From: Murray Date: Sun, 14 Jan 2018 11:49:16 -0600 Subject: [PATCH 07/12] replaced accidental (and misnamed) copy of arduino-dfu firmware with the correct speeduino arduino-usbserial one --- ...ino-usbserial-atmega16u2-Mega2560-Rev3.hex | 454 ++++++++++-------- 1 file changed, 250 insertions(+), 204 deletions(-) diff --git a/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex index 17db493b..6925ec89 100644 --- a/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex +++ b/reference/bootloaders/Speeduino-usbserial-atmega16u2-Mega2560-Rev3.hex @@ -1,205 +1,251 @@ -:1010000039C0000052C0000050C000004EC00000B7 -:101010004CC000004AC0000048C0000046C00000AC -:1010200044C0000042C0000040C000009AC400005C -:101030003CC000003AC0000038C0000036C00000CC -:1010400034C0000032C0000030C000002EC00000DC -:101050002CC000002AC0000028C0000026C00000EC -:1010600024C0000022C0000020C000001EC00000FC -:101070001CC0000011241FBECFEFD2E0DEBFCDBFE9 -:1010800011E0A0E0B1E0E0E4FCE102C005900D92C7 -:10109000A836B107D9F721E0A8E6B1E001C01D925A -:1010A000A738B207E1F726D1C9C5AACF815080F091 -:1010B0009091F20091110DC09091E8009B7F909368 -:1010C000E8009091E80092FDF1CF9EB39111F9CF25 -:1010D00008959091F100EACFE1E7F1E035812481B4 -:1010E0009381828190936A0180936B01C9019093EF -:1010F0006801809369010895CF93DF9300D000D0F9 -:1011000000D0CDB7DEB780917101843009F45CC0A6 -:1011100068F48130E9F08330A1F126960FB6F89497 -:10112000DEBF0FBECDBFDF91CF910895853009F4AA -:1011300098C0863091F780917201833071F7809169 -:1011400073018111EACF8091740180936C01E5CF26 -:1011500080917201823008F7BFDF809172018111A6 -:101160000CC080916A0190916B0123E0FC012093F7 -:101170005700E89507B600FCFDCF85E0809300019D -:10118000CCCF80917201982F9D7F19F4A5DF89E063 -:10119000F5CF813009F0C1CFF0E0E0E084918F3FDE -:1011A00069F010926C01F0936B01E0936A018AE0A0 -:1011B0008093000185E080936F01AFCF3196E115F8 -:1011C00020E1F20759F7A9CF80917201833039F5F8 -:1011D00081E08093700180917301209177013091BB -:1011E0007801232B61F0813009F097CF909176013F -:1011F0008091750190936D0180936E018ECF811166 -:101200000BC088E19CE00FB6F894A895809360002D -:101210000FBE9093600081CF109201017ECF8111AB -:101220007CCF809173018F3F09F077CFF0E0E0E051 -:1012300083E095E080935700E89507B600FCFDCF6A -:1012400090935700E89507B600FCFDCFE058FF4F9C -:10125000E11520E1F20771F781E180935700E895ED -:101260005CCF8091610190916201A09163018C83B8 -:101270009D83AE838091640190916501A091660188 -:1012800089839A83AB83E09173018091720181110C -:1012900007C0EC0FFD2FF11D848180937C013DCFB1 -:1012A000813009F03ACF81ED9FEF8C0F9D1F8E0F9B -:1012B000911DFC018081F1CF84B7877F84BF0FB679 -:1012C000F894A895809160008861809360001092E6 -:1012D00060000FBE81E085BF82E085BF8AB1806378 -:1012E0008AB98BB180638BB91BC31FD381E085BFE3 -:1012F00015BE0895E1DF78948091010181110AC043 -:1013000080917001811106C0F0DFE0916D01F091D4 -:101310006E0109956FD4F0CF7F928F929F92AF921A -:10132000BF92CF92DF92EF92FF920F931F93CF93D2 -:10133000DF9380918501909186019093780180934D -:10134000770180917901882341F080917901815062 -:1013500080937901811101C05D9A80917A0188237F -:1013600041F080917A01815080937A01811101C00E -:101370005C9A80918001833009F4B6C198F4813081 -:1013800019F1823009F41FC1DF91CF911F910F91A4 -:10139000FF90EF90DF90CF90BF90AF909F908F9095 -:1013A0007F900895853009F4BDC108F4B3C186303B -:1013B00059F78091E800877F8093E8005D9A5C9AF6 -:1013C00082E0809300012BC05C9883E080937A01D7 -:1013D0008091E800877F8093E800809170018823E6 -:1013E00029F08ADE5D9A5C9A1092700180917701F3 -:1013F00090917801009729F580910001853051F492 -:101400008091770190917801892B09F03FC082E0AB -:10141000809300018091E8008B7F8093E800DF914A -:10142000CF911F910F91FF90EF90DF90CF90BF90E1 -:10143000AF909F908F907F90C7C12EB3222309F465 -:10144000A3CF2091E80022FFF8CF2091F100209354 -:10145000710101979093780180937701E2E7F1E0C1 -:101460008091F200882381F08091F1008193809136 -:10147000770190917801019790937801809377019B -:1014800021E0E737F20761F737DEB6CF8AE10EDEFB -:1014900080916A018F710ADE20916A0130916B019F -:1014A000C0916801D09169012196C21BD30B809134 -:1014B0007201811178C0D695C795C90120916C0140 -:1014C000A22FB0E04C0120E011E005E033E0732EE4 -:1014D000AE0141505109CD2B79F480916801909172 -:1014E000690190936B0180936A0181E180935700B9 -:1014F000E89580E1DBDD8ECF3091F200332361F19E -:10150000E091F1003091F1006E2F732FFC010B017F -:1015100010935700E89511242F5F6C017D01F2E0D4 -:10152000CF0ED11CE11CF11CD701C601203409F5F6 -:10153000F40100935700E89507B600FCFDCF411574 -:101540005105D1F0F60170925700E89507B600FCFE -:10155000FDCF20E0460110C03091E8003B7F309382 -:10156000E8003091E80032FDCBCF3EB33111F9CF26 -:101570000BCF41155105E1F2EA01AACF8091F200AB -:101580008823A1F021976091F10080916A019091E8 -:101590006B0146D380916A0190916B010196909303 -:1015A0006B0180936A01209749F7A3CF8091E800EF -:1015B0008B7F8093E8008091E80082FDE3CF8EB3BB -:1015C0008111F9CFE1CE8091E800877F8093E80018 -:1015D0005D9883E0809379018091E80080FF16C0D8 -:1015E000809100018930C9F08A30A1F480917201A4 -:1015F000813081F490916A0180916B019093F100A8 -:101600008093F1008091E8008E7F07CF8EB3811127 -:10161000E3CFBACE80917C01F3CF20916A01309163 -:101620006B01C0916801D09169012196C21BD30B57 -:1016300080917201811131C0D695C795C901209161 -:101640006C01A22FB0E0219760F480916801909125 -:10165000690190936B0180936A0182E0809300019D -:10166000D1CF2091F200203259F0FC012591349124 -:101670002093F1003093F1000296A11DB11DE3CF3C -:101680002091E8002E7F2093E8002091E80020FDC3 -:10169000ECCF2EB32111F9CF77CE8230F1F620971F -:1016A000E1F28091F200803291F080916A01909194 -:1016B0006B01AED28093F10080916A0190916B0131 -:1016C000019690936B0180936A012197E8CF8091F6 -:1016D000E8008E7F8093E8008091E80080FDE5CFF0 -:1016E0008EB38111F9CF50CE8091E800877F80932F -:1016F000E80080916F018093F1001092F100109248 -:10170000F1001092F100809100018093F10010929D -:10171000F10078CF8091E800877F8093E8001092F5 -:101720006F017DCE8091E800877F8093E8008091F3 -:10173000000166CF292F30E02230310571F02330CF -:10174000310581F021303105D9F482E190E02FE4B8 -:1017500031E0FA013183208308958BE190E024E3A6 -:1017600031E0F7CF811106C08091300190E020E395 -:1017700031E0EFCF8091020190E022E031E0E9CF4B -:1017800090E080E030E020E0E4CFEBEEF0E080811C -:1017900081608083EDEEF0E010826093EC00408386 -:1017A0008091EE00881F8827881F08951092F4000A -:1017B0001092F0001092E8001092ED00EBEEF0E0D5 -:1017C00080818E7F8083089580917F0187FF11C083 -:1017D0008091E80082FF06C08091E8008B7F8093B3 -:1017E000E80003C08EB38111F3CF08958EB3882330 -:1017F000E1F38091E80080FFF9CF8091E8008E7FCF -:10180000EECF209185013091860126173707A0F091 -:101810006115710529F42091E8002E7F2093E800DE -:1018200030E06115710551F4311108C08091E80074 -:1018300082FF30C080E00895B901F2CF2091E80026 -:1018400023FD30C02091E80022FDF0CF2EB32223EB -:1018500059F12EB3253021F12091E80020FFE1CF8E -:101860002091F200FC01CF016115710511F02032C9 -:1018700050F031E0203209F030E02091E8002E7F76 -:101880002093E800CECF81918093F10061507109DF -:101890002F5FE9CF8EB3882339F08EB3853031F6D0 -:1018A00083E0089581E0089582E0089554D056D0F1 -:1018B0001EBA10927D0184E089BD89B5826089BD20 -:1018C00009B400FEFDCF8091D800982F9F779093A8 -:1018D000D80080688093D800809163008E7F8093C9 -:1018E00063008091D8008F7D8093D8008091E000C4 -:1018F0008E7F8093E0008091E1008E7F8093E100F5 -:101900008091E20081608093E2008091E100877F16 -:101910008093E1008091E20088608093E200089566 -:10192000C5DF81E080937E010895C0DFE0EEF0E046 -:10193000808181608083E8EDF0E080818F77808313 -:101940000AD00CD019BCE3E6F0E08081816080838E -:1019500010927E0108951092E20008951092E10025 -:1019600008951F920F920FB60F9211242F933F9359 -:101970004F935F936F937F938F939F93AF93BF9397 -:10198000EF93FF938091E10080FF1BC08091E20004 -:1019900080FF17C08091E1008E7F8093E1008091ED -:1019A000E2008E7F8093E2008091E200806180936C -:1019B000E2008091D80080628093D80019BC1EBAE2 -:1019C00018D18091E10084FF27C08091E20084FF5C -:1019D00023C084E089BD89B5826089BD09B400FE59 -:1019E000FDCF8091D8008F7D8093D8008091E10059 -:1019F0008F7E8093E1008091E2008F7E8093E200F1 -:101A00008091E20081608093E20080917D018111EC -:101A100048C081E08EBBEDD08091E10083FF22C001 -:101A20008091E20083FF1EC08091E100877F809358 -:101A3000E10082E08EBB10927D018091E1008E7FFB -:101A40008093E1008091E2008E7F8093E20080919C -:101A5000E20080618093E200A9DE42E260E080E083 -:101A600094DEC7D08091E10082FF0AC08091E2003D -:101A700082FF06C08091E1008B7F8093E100B9D0A6 -:101A8000FF91EF91BF91AF919F918F917F916F9156 -:101A90005F914F913F912F910F900FBE0F901F902C -:101AA000189584E0B7CF1F93CF93DF9300D0CDB7C5 -:101AB000DEB7EFE7F1E087E891E02091F1002193B4 -:101AC0008E179F07D1F780917F01E0918001EA3066 -:101AD00038F5F0E0E359F24F95C0770D8E0D900D7B -:101AE0008E0D900D920DAE0D900DCD0DE00D8D7FF4 -:101AF0008038B1F48091E80083FF0AC08091EB0048 -:101B000080628093EB008091E800877F8093E800FB -:101B10000F900F90DF91CF911F9108958D7F51F31A -:101B2000FBDBE8CF8111FCCF109181018091E800AF -:101B3000877F8093E80048DE8091E80080FF0AC03C -:101B4000812F8F7792E009F093E09EBB80688093AD -:101B5000E300D0CF8EB38111EFCFCCCF805882304D -:101B6000F8F6AE014F5F5F4F609183018091810174 -:101B700090918201DFDDBC01892B09F4BBCF9091EC -:101B8000E800977F9093E80089819A813ADE8091FE -:101B9000E8008B7F8093E800ADCF803809F0C0CF9C -:101BA0008091E800877F8093E80080917D01809399 -:101BB000F1008091E8008E7F8093E80005DE9ACFE7 -:101BC0008111AECF90918101923008F093CF809136 -:101BD000E800877F8093E80090937D01F5DD809198 -:101BE0007D01811104C083E08EBB03D083CF84E0EC -:101BF000FBCF08958EB3882321F08091E80083FD08 -:101C000052CF0895EE0FFF1F0590F491E02D099437 -:101C1000F999FECF92BD81BDF89A992780B50895B4 -:101C2000262FF999FECF1FBA92BD81BD20BD0FB6F8 -:101C3000F894FA9AF99A0FBE01960895F894FFCF96 -:101C400002012C03410072006400750069006E00FF -:101C50006F0020004D006500670061002000320029 -:101C600035003600300020004400460055000000DA -:101C70000403090409021B00010100803209040069 -:101C80000000FE0102000921030000000C00011207 -:101C900001100100000020EB03EF2F000000010005 -:081CA0000120DCFB1E94890009 -:0400000300001000E9 +:1000000092C00000ABC00000A9C00000A7C0000063 +:10001000A5C00000A3C00000A1C000009FC0000058 +:100020009DC000009BC0000099C0000014C40000E7 +:10003000B9C4000093C0000091C000008FC0000050 +:100040008DC000008BC0000089C0000087C0000088 +:1000500085C0000083C0000081C00000E7C100002F +:100060007DC000007BC0000079C0000077C00000A8 +:1000700075C000002803530070006500650064002F +:10008000750069006E006F0020004D00650067007C +:1000900061002000320035003600300000003203DD +:1000A000410072006400750069006E006F0020005E +:1000B00028007700770077002E006100720064004E +:1000C000750069006E006F002E0063006300290058 +:1000D00000000403090409023E00020100C03209C5 +:1000E00004000001020201000524000110042402A2 +:1000F000060524060001070582030800FF09040124 +:1001000000020A0000000705040240000107058301 +:10011000024000011201100102000008EB034B2015 +:1001200001000102DC0111241FBECFEFD2E0DEBFCF +:10013000CDBF11E0A0E0B1E0ECE7FFE002C0059028 +:100140000D92A831B107D9F722E0A8E1B1E001C0D2 +:100150001D92A133B207E1F74CD00EC751CFFC017D +:10016000E058FF4FA081B1816C93A081B1819D01C6 +:100170002F5F3F4F2E173F0761F0318320832FB74A +:10018000F894FC01EC57FF4F80818F5F80832FBF75 +:10019000089512969C938E931197F1CF84B7877F21 +:1001A00084BF0FB6F894A895809160008861809311 +:1001B0006000109260000FBE87E690E09093CD0043 +:1001C0008093CC0086E08093CA001092C80088E13A +:1001D0008093C900539A5A9A8AB180638AB98BB1C5 +:1001E00080638BB92DD384E085BD5F9A579A279899 +:1001F0000895D4DF2FB7F89480EA91E0909321021C +:100200008093200290932302809322022FBF2FB766 +:10021000F8948BE191E090939C0180939B019093E3 +:100220009E0180939D012FBF78948C0183E0F82E6E +:100230009FB7F894809124029FBF8038D1F080E06E +:1002400091E048D6EC0197FD14C0909116019923D6 +:1002500051F0863441F460E680EA91E080DF61E0AD +:1002600080EA91E07CDF6C2F80EA91E078DF1092E9 +:1002700016018FB7F894C0919F018FBFA89902C053 +:10028000C13618F1A89A80919F01882319F05D98D2 +:10029000F0921801C15008F042C0809118018823E3 +:1002A00041F080911801815080931801811101C0A3 +:1002B0005D9A80911901882341F080911901815044 +:1002C00080931901811101C05C9A9FB7F8948091C5 +:1002D00024029FBF8823F1F0E0912202F0912302D3 +:1002E000919182E0E032F807C1F1F0932302E093AC +:1002F00022022FB7F8948091240281508093240227 +:100300002FBF8091C80085FFFCCF9093CE005C98F2 +:10031000F092190180E091E0CFD5C5D489CFE0916A +:100320009D01F0919E01619181E0EB39F80781F028 +:10033000F0939E01E0939D019FB7F89480919F01F7 +:10034000815080939F019FBF80E091E067D5A2CF4D +:1003500010939E0100939D01EFCF20EA31E030938E +:10036000230220932202C5CF80E091E013C580E0F4 +:1003700091E0ABC40F931F93CF938C01FC01848950 +:10038000C0E3813021F0C0E2823009F0C0E0F80122 +:100390008389823009F4C860F80185898730E9F1E2 +:1003A0008830E9F1863009F4C2601092C9001092D9 +:1003B000C8001092CA00F801278530894189528906 +:1003C0002115F1EE3F074105510559F1CA01B90167 +:1003D000969587957795679560587B47814E9F4F97 +:1003E000A3D5215031093093CD002093CC00C09388 +:1003F000CA00F80187859089A189B2898115914E3B +:10040000A105B10589F082E08093C80088E9809356 +:10041000C900CF911F910F910895C460C6CFC660E7 +:10042000C4CF20E130E0DFCF80E0EECF1F920F920B +:100430000FB60F9211242F933F934F935F936F93B7 +:100440007F938F939F93AF93BF93EF93FF936091AD +:10045000CE008EB3843019F48BE191E080DEFF9101 +:10046000EF91BF91AF919F918F917F916F915F912C +:100470004F913F912F910F900FBE0F901F901895A5 +:1004800023B1FC01858580FF07C027FD05C081E001 +:10049000809316015F9808955F9A0895292F332756 +:1004A0002230310571F02330310581F021303105E2 +:1004B000A1F482E190E024E131E0FA01318320836C +:1004C00008958EE390E026ED30E0F7CF9927813054 +:1004D000910571F038F0029771F090E080E030E023 +:1004E00020E0EBCFE2EDF0E0849190E09F01E5CFDA +:1004F000EEE9F0E0F9CFE4E7F0E0F6CFAC0128E078 +:1005000030E080E02417350718F08295807F089549 +:100510008F5F220F331FF6CF8093E900EBEEF0E000 +:10052000808181608083EDEEF0E010826093EC00CA +:1005300040838091EE00881F8827881F08951092BD +:10054000F40080E08093E9001092F0001092E8003F +:100550001092ED009091EB009E7F9093EB008F5FE7 +:10056000853081F708958091290287FF11C080911D +:10057000E80082FF06C08091E8008B778093E80056 +:1005800003C08EB38111F3CF08958EB38823E1F3B6 +:100590008091E80080FFF9CF8091E8008E77EECF60 +:1005A00085E69091EC0090FF06C09091E80090FFE6 +:1005B00006C080E008959091E80092FDFACF9EB3C6 +:1005C0009923A1F09EB3953099F09091EB0095FDA1 +:1005D00011C09091E10092FFE4CF9091E1009B7FE8 +:1005E0009093E1008150E9F684E0089582E0089557 +:1005F00083E0089581E0089520912F023091300228 +:1006000026173707A0F06115710529F42091E8003D +:100610002E772093E80030E06115710551F4311117 +:1006200008C08091E80082FF30C080E00895B901E1 +:10063000F2CF2091E80023FD30C02091E80022FD98 +:10064000F0CF2EB3222359F12EB3253021F1209182 +:10065000E80020FFE1CF2091F200FC01CF016115FD +:10066000710511F0283050F031E0283009F030E009 +:100670002091E8002E772093E800CECF81918093DF +:10068000F100615071092F5FE9CF8EB3882339F0F3 +:100690008EB3853031F683E0089581E0089582E0DD +:1006A000089520912F023091300226173707A0F0CD +:1006B0006115710529F42091E8002E772093E80058 +:1006C00030E06115710551F4311108C08091E800E6 +:1006D00082FF31C080E00895B901F2CF2091E80097 +:1006E00023FD31C02091E80022FDF0CF2EB322235C +:1006F00061F12EB3253029F12091E80020FFE1CFF0 +:100700002091F200FC01CF016115710511F0283034 +:1007100050F031E0283009F030E02091E8002E77E9 +:100720002093E800CECF84918093F100615071094D +:100730002F5F3196E8CF8EB3882339F08EB38530A2 +:1007400029F683E0089581E0089582E00895611517 +:10075000710529F42091E8002B772093E8006115BA +:10076000710531F48091E80080FF20C080E0089599 +:100770002091E80023FD22C02EB3222309F12EB3DD +:100780002530D1F02091E80022FFE9CF2091F2003E +:10079000222301F39C012F5F3F4F4091F100FC01A8 +:1007A000408361507109C90189F7D4CF8EB3882382 +:1007B00039F08EB38530B1F683E0089581E0089575 +:1007C00082E0089542D044D01EBA109227021092BF +:1007D00026021092250284E089BD89B5826089BD18 +:1007E00009B400FEFDCF8091D800982F9F77909399 +:1007F000D80080688093D800809163008E7F8093BA +:1008000063008091D8008F7D8093D8008091E000B4 +:100810008E7F8093E0008091E1008E7F8093E100E5 +:100820008091E20081608093E2008091E100877F07 +:100830008093E1008091E20088608093E200089557 +:10084000C1DF81E08093280208951092E2000895AC +:100850001092E10008951F920F920FB60F9211248B +:100860002F933F934F935F936F937F938F939F93B8 +:10087000AF93BF93EF93FF938091E10080FF1BC084 +:100880008091E20080FF17C08091E1008E7F80930D +:10089000E1008091E2008E7F8093E2008091E2008F +:1008A00080618093E2008091D80080628093D800BC +:1008B00019BC1EBAF7D18091E10084FF27C0809156 +:1008C000E20084FF23C084E089BD89B5826089BDD0 +:1008D00009B400FEFDCF8091D8008F7D8093D800B1 +:1008E0008091E1008F7E8093E1008091E2008F7E15 +:1008F0008093E2008091E20081608093E200809129 +:10090000270281114DC081E08EBBCCD18091E100E6 +:1009100083FF27C08091E20083FF23C08091E10024 +:10092000877F8093E10082E08EBB10922702809146 +:10093000E1008E7F8093E1008091E2008E7F8093C2 +:10094000E2008091E20080618093E200F8DD42E005 +:1009500060E080E0E1DD8091F00088608093F0004D +:10096000A1D18091E10082FF0AC08091E20082FF64 +:1009700006C08091E1008B7F8093E10093D1FF91CD +:10098000EF91BF91AF919F918F917F916F915F9107 +:100990004F913F912F910F900FBE0F901F90189580 +:1009A00084E0B2CF1F920F920FB60F921124FF92E4 +:1009B0000F931F932F933F934F935F936F937F9367 +:1009C0008F939F93AF93BF93CF93DF93EF93FF9357 +:1009D000C9EED0E088818770F82E188200EF10E011 +:1009E000F8018081877F808378941DD0F8941882E5 +:1009F000F801808188608083F882FF91EF91DF9118 +:100A0000CF91BF91AF919F918F917F916F915F91A6 +:100A10004F913F912F911F910F91FF900F900FBE1B +:100A20000F901F9018951F93CF93DF93CDB7DEB72C +:100A3000AA970FB6F894DEBF0FBECDBFE9E2F2E091 +:100A40008091F100819322E0E133F207C9F78091B0 +:100A5000290290912A029A3008F022C1E92FF0E091 +:100A6000ED5CFA4F83C23D056205500662055006F3 +:100A7000BD05D90550062B063706803881F082382F +:100A800009F00EC180912D0287708093E90080915A +:100A9000EB0085FB882780F91092E90006C0809161 +:100AA000250290912602911182609091E800977F33 +:100AB0009093E8008093F1001092F1008091E8009B +:100AC0008E772EC0282F2D7F09F0EAC08823D1F021 +:100AD000823051F18091E80083FF0AC08091EB00E1 +:100AE00080628093EB008091E800877F8093E8002C +:100AF000AA960FB6F894DEBF0FBECDBFDF91CF919F +:100B00001F91089580912B02813021F7933009F0D5 +:100B100080E0809326021092E9008091E800877FB0 +:100B20008093E80020DDD6CF80912B028111F3CF96 +:100B300080912D02877071F28093E9002091EB0083 +:100B400020FFC8CF933031F48091EB008062809316 +:100B5000EB00E1CF9091EB0090619093EB0021E0EE +:100B600030E001C0220F8A95EAF72093EA00109244 +:100B7000EA008091EB008860EACF811191C010916A +:100B80002B028091E800877F8093E800ECDC809165 +:100B9000E80080FF0AC0812F8F7792E009F093E090 +:100BA0009EBB80688093E30095CF8EB38111EFCF19 +:100BB00091CF8058823008F073C080912B029091C1 +:100BC0002C028C3D23E0920799F583E08A838AE228 +:100BD00089834FB7F894DE01139620E03EE051E29E +:100BE000E32FF0E050935700E49120FF03C0E2951B +:100BF000EF703F5FEF7080E38E0F8A3310F087E372 +:100C00008E0F90E08D939D932F5F243149F74FBF56 +:100C10008091E800877F8093E8006AE270E0CE016F +:100C20000196EADC8091E8008B778093E80052CF50 +:100C3000AE014F5F5F4F60912D0230DCBC01892B0C +:100C400009F448CF9091E800977F9093E80089815C +:100C50009A8127DDE7CF803819F58091E800877FFA +:100C60008093E800809127028093F10027CF8111C3 +:100C700017C090912B02923008F02CCF8091E800A1 +:100C8000877F8093E800909327026DDC8091270294 +:100C9000811104C083E08EBB67DB1CCF84E0FBCFF7 +:100CA00066DB18CF0895CF938EB3882359F0C09197 +:100CB000E900C7701092E9008091E80083FDB3DE7F +:100CC000C093E900CF9108950895CF93DF93EC018D +:100CD0008091E80083FF0FC0288180912D029091C0 +:100CE0002E022817190639F480912A028132C1F0A8 +:100CF00028F4803249F1DF91CF9108958232C1F119 +:100D00008332C9F7809129028132A9F78091E800E6 +:100D1000877F8093E80060912B02CE01D5DF37C03A +:100D200080912902813A39F78091E800877F80938A +:100D3000E80067E070E0CE010F965EDC8091E8008D +:100D40008B778093E800D7CF80912902813299F682 +:100D50008091E800877F8093E80067E070E0CE0133 +:100D60000F96F5DCCE0106DB8091E8008E77E9CFA7 +:100D700080912902813209F0BECF8091E800877FFF +:100D80008093E80080912B028D87CE0179DBDF9183 +:100D9000CF91E9CB0F931F93CF93DF93EC01FC012D +:100DA0003D9689E0DF011D928A95E9F78A819B8152 +:100DB0002C8110E0211114E00981A0DB812B482F48 +:100DC000426061E8802FA8DB882311F18E819F812A +:100DD000288510E0211114E00D8190DB812B482F34 +:100DE000426060E8802F98DB882391F08A859B859C +:100DF0002C8510E0211114E0C98580DB812B482F60 +:100E0000426061EC8C2FDF91CF911F910F9184CBC9 +:100E100080E0DF91CF911F910F910895CF93C62F5E +:100E20002EB32430F1F4FC01478550896189728921 +:100E3000452B462B472BA9F081818093E9008091B7 +:100E4000E80085FF05C0C093F10080E0CF910895D0 +:100E50008091E8008E778093E800A2DB882399F3E5 +:100E6000F5CF82E0F3CF2EB3243021F5FC01478586 +:100E7000508961897289452B462B472BD9F0818196 +:100E80008093E9008091F200811102C080E0089512 +:100E90009091E8008091E8008E778093E80095FDBE +:100EA000F5CF7EDB811107C09091E8009E7790938B +:100EB000E800089582E008952EB3243051F4FC0137 +:100EC0004785508961897289452B462B472B09F04C +:100ED000CACF08952EB3243019F08FEF9FEF0895F5 +:100EE000FC014785508961897289452B462B472B28 +:100EF000A1F385818093E9008091E80082FFEDCF26 +:100F00008091F200882369F08091F10090E02091B7 +:100F1000F200211105C02091E8002B772093E80012 +:100F200008958FEF9FEFF3CFA1E21A2EAA1BBB1BF0 +:100F3000FD010DC0AA1FBB1FEE1FFF1FA217B307A5 +:100F4000E407F50720F0A21BB30BE40BF50B661FBB +:100F5000771F881F991F1A9469F76095709580957F +:100F600090959B01AC01BD01CF010895EE0FFF1FCD +:0C0F70000590F491E02D0994F894FFCF57 +:100F7C0000034000000440000002080000000000D4 +:080F8C0000000000000001005C :00000001FF From d07d20ffb8d8b0a324fe881eb04ab9fd15df3e5f Mon Sep 17 00:00:00 2001 From: Murray Date: Tue, 16 Jan 2018 20:02:04 -0600 Subject: [PATCH 08/12] ini spec version bump to maximum supported by the current stable TunerStudio. removed debug code from comms.ino. updated ini file so that only appropriate options will be shown based on whether the connected Speeduino is using the custom firmware. --- reference/speeduino.ini | 23 +++++++++++++++-------- speeduino/comms.ino | 3 +-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 4fc864c4..ec2cfaa2 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -10,7 +10,7 @@ versionInfo = "S" ;This info is what is displayed to user [TunerStudio] - iniSpecVersion = 3.46 + iniSpecVersion = 3.51 ;------------------------------------------------------------------------------- @@ -282,7 +282,8 @@ page = 4 sparkDur = scalar, U08, 7, "ms", 0.1, 0, 0, 25.5, 1 ; Spark duration unused4-8 = scalar, U08, 8, "ms", 0.1, 0.0, 0.0, 25.5, 1 bootloaderCaps = scalar, U08, 9, "level", 1, 0, 0, 255, 0 - resetControl = bits, U08, 10,[0:1], "Disabled", "Prevent When Running", "Prevent Always", "Serial Command" + resetControl_custom = bits, U08, 10,[0:1], "Disabled", "Prevent When Running", "Prevent Always", "Serial Command" + resetControl_standard = bits, U08, 10,[0:1], "Disabled", "INVALID", "INVALID", "Enabled" resetControlPin = bits, U08, 10,[2:7], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" SkipCycles = scalar, U08, 11, "cycles", 1, 0, 0, 255, 0 @@ -754,7 +755,8 @@ page = 10 requiresPowerCycle = stagedInjSizePri requiresPowerCycle = stagedInjSizeSec requiresPowerCycle = stagingEnabled - requiresPowerCycle = resetControl + requiresPowerCycle = resetControl_custom + requiresPowerCycle = resetControl_standard requiresPowerCycle = resetControlPin defaultValue = pinLayout, 1 @@ -804,7 +806,8 @@ page = 10 defaultValue = realtime_base_address, 336 defaultValue = VVTasOnOff, 0 defaultValue = stagingEnabled, 0 - defaultValue = resetControl, 0 + defaultValue = resetControl_custom, 0 + defaultValue = resetControl_standard, 0 defaultValue = bootloaderCaps, 0 ; defaultValue = obd_address, 0 @@ -856,7 +859,7 @@ menuDialog = main subMenu = airdensity_curve, "IAT Density" subMenu = reset_control, "Reset Control" - + menu = "&Tuning" subMenu = std_realtime, "Realtime Display" subMenu = accelEnrichments, "Acceleration Enrichment" @@ -1102,8 +1105,9 @@ menuDialog = main stagedInjSizePri= "Size of the primary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" stagedInjSizeSec= "Size of the secondary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation" - resetControl = "How to control the Arduino's automatic reset feature. NOTE: Some of these settings require modifying your hardware and possibly replacing the Arduino bootloader. See the Wiki for more details.\n\nDisabled: Allow the Arduino to reset when a new serial connection is made.\n\nPrevent When Running: Hold the control pin high while the engine is running.\n\nPrevent Always: Always hold the control pin high.\n\nSerial Command: Normally hold the control pin high, but pull it low when the 'U' serial command is issued and reset upon receiving more data." - resetControlPin = "The Arduino pin used to control resets." + resetControl_standard = "Whether to enable reset control of the Arduino's automatic reset feature. If this feature is enabled, the selected control pin will be held high at all times. In order to update your Speeduino's firmware, you will first need to open a serial terminal and send a 'U' command so that the Arduino resets when the upload starts. The control pin should be connected to the Arduino's reset pin." + resetControl_custom = "How to control the Arduino's automatic reset feature. NOTE: Some of these settings require modifying your hardware and replacing the Arduino bootloader. See the Wiki for more details.\n\nDisabled: Allow the Arduino to reset when a new serial connection is made.\n\nPrevent When Running: Hold the control pin high while the engine is running.\n\nPrevent Always: Always hold the control pin high.\n\nSerial Command: Normally hold the control pin high, but pull it low when the 'U' serial command is issued and reset upon receiving more data." + resetControlPin = "The Arduino pin used to control resets." [UserDefined] @@ -1811,7 +1815,10 @@ menuDialog = main field = "Enable Second Serial", enable_canbus dialog = reset_control, "Reset Control" - field = "Control Type", resetControl + ; Control type options for custom firmware + field = "Control Type", resetControl_custom, { bootloaderCaps > 0 }, { bootloaderCaps > 0 } + ; Control type options for standard / unmodifyable firmware + field = "Control Type", resetControl_standard, { bootloaderCaps == 0 }, { bootloaderCaps == 0 } field = "Control Pin", resetControlPin ;------------------------------------------------------------------------------- diff --git a/speeduino/comms.ino b/speeduino/comms.ino index c90f84d6..1277c484 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -315,8 +315,7 @@ void command() cmdPending = true; if (Serial.available() >= 1) { - //configPage2.bootloaderCaps = Serial.read(); - configPage2.bootloaderCaps = 0; + configPage2.bootloaderCaps = Serial.read(); cmdPending = false; } break; From 2350d5d7855fe7c85dac61764164f80580732f37 Mon Sep 17 00:00:00 2001 From: Murray Date: Fri, 19 Jan 2018 21:25:01 -0600 Subject: [PATCH 09/12] Table-based flex fuel corrections Changed the linear low / high flex fuel correction method to a table2D-based one. --- .gitignore | 2 ++ reference/speeduino.ini | 49 ++++++++++++++++++++++++++++----------- speeduino/auxiliaries.ino | 6 +++-- speeduino/corrections.ino | 17 +++++++------- speeduino/globals.h | 35 +++++++++++++++++++++------- speeduino/speeduino.ino | 15 +++++++++++- speeduino/timers.ino | 2 +- speeduino/updates.ino | 18 +++++++++++++- 8 files changed, 110 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 52197162..be0641a2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ reference/hardware/v0.4/gerbers/Archive.zip .project .vscode .build +.vscode/c_cpp_properties.json +.vscode/launch.json diff --git a/reference/speeduino.ini b/reference/speeduino.ini index c841024c..421b3ea1 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -158,8 +158,8 @@ page = 1 ;Page 2 is all general settings (Previously part of page 1) ;-------------------------------------------------- page = 2 - flexBoostLow = scalar, S08, 0, "kPa", 1.0, 0.0, -127, 127, 0 - flexBoostHigh = scalar, U08, 1, "kPa", 1.0, 0.0, 0.0, 255, 0 + unused2-1 = scalar, S08, 0, "kPa", 1.0, 0.0, -127, 127, 0 + unused2-2 = scalar, U08, 1, "kPa", 1.0, 0.0, 0.0, 255, 0 asePct = scalar, U08, 2, "%", 1.0, 0.0, 0.0, 95.0, 0 aseCount = scalar, U08, 3, "s", 1.0, 0.0, 0.0, 255, 0 wueRates = array, U08, 4, [10], "%", 1.0, 0.0, 0.0, 255, 0 @@ -236,10 +236,10 @@ page = 2 oddfire3 = scalar, U16, 53, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte) oddfire4 = scalar, U16, 55, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte) - flexFuelLow = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0 - flexFuelHigh = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 250.0, 0 - flexAdvLow = scalar, U08, 59, "Deg", 1.0, 0.0, 0.0, 250.0, 0 - flexAdvHigh = scalar, U08, 60, "Deg", 1.0, 0.0, 0.0, 250.0, 0 + unused2-57 = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0 + unused2-58 = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 250.0, 0 + unused2-59 = scalar, U08, 59, "Deg", 1.0, 0.0, 0.0, 250.0, 0 + unused2-60 = scalar, U08, 60, "Deg", 1.0, 0.0, 0.0, 250.0, 0 iacCLminDuty = scalar, U08, 61, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles when using closed loop idle iacCLmaxDuty = scalar, U08, 62, "%", 1.0, 0.0, 0.0, 100.0, 0 @@ -705,7 +705,14 @@ page = 10 #endif boostSens = scalar, U16, 25, "", 1, 0, 0, 5000, 0 boostIntv = scalar, U08, 27, "ms", 1, 0, 0, 250, 0 - unused11_28_192 = array, U08, 28,[163], "RPM", 100.0, 0.0, 100, 25500, 0 + + flexCorrectionBins = array, U08, 28, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + ; The boost range is obviously arbitrary since int16_t has ~32k in both directions + flexCorrectionBoost = array, S16, 34, [6], "kPa", 1.0, 0.0, -500.0, 500.0, 0 + flexCorrectionFuel = array, U08, 46, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + flexCorrectionAdv = array, U08, 52, [6], "Deg", 1.0, 0.0, 0.0, 250.0, 0 + + unused11_53_192 = array, U08, 53,[139], "RPM", 100.0, 0.0, 100, 25500, 0 ;------------------------------------------------------------------------------- @@ -1128,16 +1135,16 @@ menuDialog = main dialog = flexMiddle, "" field = "Low (E0)" field = "", flexFreqLow, { flexEnabled } - field = "", flexFuelLow, { flexEnabled } - field = "", flexAdvLow, { flexEnabled } - field = "", flexBoostLow, { boostEnabled } + ;field = "", flexFuelLow, { flexEnabled && 0 } + ;field = "", flexAdvLow, { flexEnabled && 0 } + ;field = "", flexBoostLow, { boostEnabled } dialog = flexRight, "" field = "High (E100)" field = "", flexFreqHigh, { flexEnabled } - field = "", flexFuelHigh, { flexEnabled } - field = "", flexAdvHigh, { flexEnabled } - field = "", flexBoostHigh, { flexEnabled && boostEnabled } + ;field = "", flexFuelHigh, { flexEnabled && 0 } + ;field = "", flexAdvHigh, { flexEnabled && 0 } + ;field = "", flexBoostHigh, { flexEnabled && boostEnabled } dialog = flexMain, "Flex Fuel Calibration", xAxis panel = flexLeft @@ -1151,6 +1158,8 @@ menuDialog = main topicHelp = "http://speeduino.com/wiki/index.php/Flex_Fuel" panel = flexFuelTop panel = flexMain + panel = flex_corrections_curve, { flexEnabled } + dialog = tacho, "Tacho" field = "Output pin", tachoPin @@ -1917,6 +1926,20 @@ cmdtestspk450dc = "E\x03\x0C" xBins = crankingEnrichBins, coolant yBins = crankingEnrichValues ;gauge = cltGau25 + +; Flex fuel correction curves + curve = flex_corrections_curve, "Flex Fuel Corrections" + columnLabel = "Ethanol %", "Correction Type" + xAxis = 0, 100, 5 + xBins = flexCorrectionBins, flex + yBins = flexCorrectionFuel + yBins = flexCorrectionAdv + yBins = flexCorrectionBoost, { boostEnabled } + lineLabel = "Fuel Adj." + lineLabel = "Add'l. Adv." + lineLabel = "Add'l. Boost" + showTextValues = true + size = 640, 480 ; Warmup enrichment VEAL AFR adjustment curve (Not currently working) ;curve = warmup_afr_curve, "AFR Target Temperature Adustment" diff --git a/speeduino/auxiliaries.ino b/speeduino/auxiliaries.ino index 79bd21aa..3a78670b 100644 --- a/speeduino/auxiliaries.ino +++ b/speeduino/auxiliaries.ino @@ -80,8 +80,10 @@ void boostControl() //If flex fuel is enabled, there can be an adder to the boost target based on ethanol content if( configPage1.flexEnabled == 1 ) { - int16_t boostAdder = (((int16_t)configPage1.flexBoostHigh - (int16_t)configPage1.flexBoostLow) * currentStatus.ethanolPct) / 100; - boostAdder = boostAdder + configPage1.flexBoostLow; //Required in case flexBoostLow is less than 0 + int16_t boostAdder = flexLookupCache.boost = BIT_CHECK(TIMER_mask, BIT_TIMER_4HZ) || !flexLookupCache.boostReady + ? table2D_getValue(&flexCorrectionBoostTable, currentStatus.ethanolPct) + : flexLookupCache.boost; + currentStatus.boostTarget += boostAdder; } diff --git a/speeduino/corrections.ino b/speeduino/corrections.ino index b4f9d290..5b4c9314 100644 --- a/speeduino/corrections.ino +++ b/speeduino/corrections.ino @@ -19,6 +19,7 @@ Flood clear mode etc. long PID_O2, PID_output, PID_AFRTarget; PID egoPID(&PID_O2, &PID_output, &PID_AFRTarget, configPage3.egoKP, configPage3.egoKI, configPage3.egoKD, REVERSE); //This is the PID object if that algorithm is used. Needs to be global as it maintains state outside of each function call + void initialiseCorrections() { egoPID.SetMode(AUTOMATIC); //Turn O2 PID on @@ -279,10 +280,11 @@ static inline bool correctionDFCO() static inline byte correctionFlex() { byte flexValue = 100; - if(configPage1.flexEnabled == 1) + if (configPage1.flexEnabled == 1) { - byte flexRange = configPage1.flexFuelHigh - configPage1.flexFuelLow; - flexValue = percentage(currentStatus.ethanolPct, flexRange) + 100; + flexValue = flexLookupCache.fuel = BIT_CHECK(TIMER_mask, BIT_TIMER_4HZ) || !flexLookupCache.fuelReady + ? table2D_getValue(&flexCorrectionFuelTable, currentStatus.ethanolPct) + : flexLookupCache.fuel; } return flexValue; } @@ -405,11 +407,10 @@ static inline int8_t correctionFlexTiming(int8_t advance) byte ignFlexValue = advance; if( configPage1.flexEnabled == 1 ) //Check for flex being enabled { - byte flexRange = configPage1.flexAdvHigh - configPage1.flexAdvLow; - - if (currentStatus.ethanolPct != 0) { currentStatus.flexIgnCorrection = percentage(currentStatus.ethanolPct, flexRange); } - else { currentStatus.flexIgnCorrection = 0; } - + currentStatus.flexIgnCorrection = flexLookupCache.advance = BIT_CHECK(TIMER_mask, BIT_TIMER_4HZ) || !flexLookupCache.advanceReady + ? table2D_getValue(&flexCorrectionAdvTable, currentStatus.ethanolPct) + : flexLookupCache.advance; + ignFlexValue = advance + currentStatus.flexIgnCorrection; } return ignFlexValue; diff --git a/speeduino/globals.h b/speeduino/globals.h index 69738f8f..052dedaa 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -173,6 +173,9 @@ struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D) struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D) struct table2D rotarySplitTable; //8 bin ignition split curve for rotary leading/trailing (2D) +struct table2D flexCorrectionFuelTable; //6 bin flex fuel correction table for fuel adjustments (2D) +struct table2D flexCorrectionAdvTable; //6 bin flex fuel correction table for timing advance (2D) +struct table2D flexCorrectionBoostTable; //6 bin flex fuel correction table for boost adjustments (2D) //These are for the direct port manipulation of the injectors and coils volatile byte *inj1_pin_port; @@ -309,8 +312,8 @@ struct statuses currentStatus; //The global status object //This mostly covers off variables that are required for fuel struct config1 { - int8_t flexBoostLow; //Must be signed to allow for negatives - byte flexBoostHigh; + byte unused2_1; + byte unused2_2; byte asePct; //Afterstart enrichment (%) byte aseCount; //Afterstart enrichment cycles. This is the number of ignition cycles that the afterstart enrichment % lasts for byte wueValues[10]; //Warm up enrichment array (10 bytes) @@ -385,10 +388,10 @@ struct config1 { uint16_t oddfire2; //The ATDC angle of channel 2 for oddfire uint16_t oddfire3; //The ATDC angle of channel 3 for oddfire uint16_t oddfire4; //The ATDC angle of channel 4 for oddfire - byte flexFuelLow; //Fuel % to be used for the lowest ethanol reading (Typically 100%) - byte flexFuelHigh; //Fuel % to be used for the highest ethanol reading (Typically 163%) - byte flexAdvLow; //Additional advance (in degrees) at lowest ethanol reading (Typically 0) - byte flexAdvHigh; //Additional advance (in degrees) at highest ethanol reading (Varies, usually 10-20) + byte unused2_57; + byte unused2_58; + byte unused2_59; + byte unused2_60; byte iacCLminDuty; byte iacCLmaxDuty; @@ -628,7 +631,13 @@ struct config11 { uint16_t boostSens; byte boostIntv; - byte unused11_28_192[164]; + + uint8_t flexCorrectionBins[6]; + int16_t flexCorrectionBoost[6]; + uint8_t flexCorrectionFuel[6]; //Fuel % to be used at current ethanol reading (typically 100% fuel @ 0% eth, 163% @ 100%) + uint8_t flexCorrectionAdv[6]; //Additional advance (in degrees) at current ethanol reading (typically 0 @ 0%, 10-20 @ 100%) + + byte unused11_53_192[139]; #if defined(CORE_AVR) }; @@ -636,6 +645,16 @@ struct config11 { } __attribute__((__packed__)); //The 32 bit systems require all structs to be fully packed #endif +struct flexCachedLookups +{ + bool fuelReady; + bool advanceReady; + bool boostReady; + byte fuel; + byte advance; + int16_t boost; +}; +struct flexCachedLookups flexLookupCache = { false, false, false, 0, 0, 0 }; byte pinInjector1; //Output pin injector 1 byte pinInjector2; //Output pin injector 2 @@ -717,4 +736,4 @@ extern byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; extern byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; -#endif // GLOBALS_H +#endif // GLOBALS_H diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 4d3c428e..35179d09 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -201,6 +201,19 @@ void setup() rotarySplitTable.values = configPage11.rotarySplitValues; rotarySplitTable.axisX = configPage11.rotarySplitBins; + flexCorrectionFuelTable.valueSize = SIZE_BYTE; + flexCorrectionFuelTable.xSize = 6; + flexCorrectionFuelTable.values = configPage11.flexCorrectionFuel; + flexCorrectionFuelTable.axisX = configPage11.flexCorrectionBins; + flexCorrectionAdvTable.valueSize = SIZE_BYTE; + flexCorrectionAdvTable.xSize = 6; + flexCorrectionAdvTable.values = configPage11.flexCorrectionAdv; + flexCorrectionAdvTable.axisX = configPage11.flexCorrectionBins; + flexCorrectionBoostTable.valueSize = SIZE_INT; + flexCorrectionBoostTable.xSize = 6; + flexCorrectionBoostTable.values16 = configPage11.flexCorrectionBoost; + flexCorrectionBoostTable.axisX = configPage11.flexCorrectionBins; + //Setup the calibration tables loadCalibration(); @@ -1480,4 +1493,4 @@ static inline unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, } } return (unsigned int)(intermediate); -} +} diff --git a/speeduino/timers.ino b/speeduino/timers.ino index 9ff1eb9a..918b7094 100644 --- a/speeduino/timers.ino +++ b/speeduino/timers.ino @@ -222,4 +222,4 @@ void oneMSInterval() //Most ARM chips can simply call a function TCNT2 = 131; //Preload timer2 with 100 cycles, leaving 156 till overflow. TIFR2 = 0x00; //Timer2 INT Flag Reg: Clear Timer Overflow Flag #endif -} +} diff --git a/speeduino/updates.ino b/speeduino/updates.ino index f9c95304..34810cf0 100644 --- a/speeduino/updates.ino +++ b/speeduino/updates.ino @@ -8,7 +8,7 @@ void doUpdates() { - #define CURRENT_DATA_VERSION 6 + #define CURRENT_DATA_VERSION 7 //May 2017 firmware introduced a -40 offset on the ignition table. Update that table to +40 if(EEPROM.read(EEPROM_DATA_VERSION) == 2) @@ -77,6 +77,22 @@ void doUpdates() loadConfig(); //Reload the config after changing everything in EEPROM } + if (EEPROM.read(EEPROM_DATA_VERSION) == 6) { + //Convert whatever flex fuel settings are there into the new tables + + for (uint8_t x = 0; x < 6; x++) + { + uint8_t pct = x * 20; + configPage11.flexCorrectionBins[x] = pct; + configPage11.flexCorrectionBoost[x] = percentage(pct, configPage1.unused2_2 - (int8_t)configPage1.unused2_1); + configPage11.flexCorrectionFuel[x] = percentage(pct, configPage1.unused2_58 - configPage1.unused2_57); + configPage11.flexCorrectionAdv[x] = percentage(pct, configPage1.unused2_60 - configPage1.unused2_59); + } + + writeAllConfig(); + EEPROM.write(EEPROM_DATA_VERSION, 7); + } + //Final check is always for 255 and 0 (Brand new arduino) if( (EEPROM.read(EEPROM_DATA_VERSION) == 0) || (EEPROM.read(EEPROM_DATA_VERSION) == 255) ) { From 23862103e566744e4d38e6ca4404a702e6bf7f52 Mon Sep 17 00:00:00 2001 From: Murray Date: Sat, 20 Jan 2018 16:33:14 -0600 Subject: [PATCH 10/12] extremely rough flex table editors. added flexBoostCorrection to currentStatus. shortened flex correction table names. gave each flex table its own set of eth% bins. fixed the incredibly broken EEPROM update code. --- reference/speeduino.ini | 33 ++++++++++++++++++--------------- speeduino/auxiliaries.ino | 13 ++++++++++--- speeduino/comms.h | 2 +- speeduino/comms.ino | 3 +++ speeduino/corrections.ino | 4 ++-- speeduino/globals.h | 20 ++++++++++++-------- speeduino/speeduino.ino | 24 ++++++++++++------------ speeduino/updates.ino | 26 ++++++++++++++++++-------- 8 files changed, 76 insertions(+), 49 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 31d9f46f..5ac1b5e9 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -717,13 +717,15 @@ page = 10 stagedInjSizePri = scalar, U16, 28, "cc/min", 1, 0, 0, 1500, 0 stagedInjSizeSec = scalar, U16, 30, "cc/min", 1, 0, 0, 1500, 0 - flexCorrectionBins = array, U08, 31, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + flexBoostBins = array, U08, 32, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 ; The boost range is obviously arbitrary since int16_t has ~32k in both directions - flexCorrectionBoost = array, S16, 37, [6], "kPa", 1.0, 0.0, -500.0, 500.0, 0 - flexCorrectionFuel = array, U08, 49, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 - flexCorrectionAdv = array, U08, 55, [6], "Deg", 1.0, 0.0, 0.0, 250.0, 0 + flexBoostAdj = array, S16, 38, [6], "kPa", 1.0, 0.0, -500.0, 500.0, 0 + flexFuelBins = array, U08, 50, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + flexFuelAdj = array, U08, 56, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + flexAdvBins = array, U08, 62, [6], "%", 1.0, 0.0, 0.0, 250.0, 0 + flexAdvAdj = array, U08, 68, [6], "Deg", 1.0, 0.0, 0.0, 250.0, 0 - unused11_53_192 = array, U08, 61,[131], "RPM", 100.0, 0.0, 100, 25500, 0 + unused11_68_192 = array, U08, 69,[123], "RPM", 100.0, 0.0, 100, 25500, 0 ;------------------------------------------------------------------------------- @@ -1994,27 +1996,27 @@ cmdtestspk450dc = "E\x03\x0C" ; Flex fuel correction curves curve = flex_fuel_curve, "Flex Fuel Adjustments" - columnLabel = "Ethanol %", "Fuel Adj." + columnLabel = "Ethanol", "Fuel" xAxis = 0, 100, 5 yAxis = 0, 255, 10 - xBins = flexCorrectionBins, flex - yBins = flexCorrectionFuel + xBins = flexFuelBins, flex + yBins = flexFuelAdj ;showTextValues = true curve = flex_adv_curve, "Flex Timing Advance" - columnLabel = "Ethanol %", "Add'l Advance" + columnLabel = "Ethanol", "Advance" xAxis = 0, 100, 5 yAxis = 0, 100, 5 - xBins = flexCorrectionBins, flex - yBins = flexCorrectionAdv + xBins = flexAdvBins, flex + yBins = flexAdvAdj ;showTextValues = true curve = flex_boost_curve, "Flex Boost Adjustments" - columnLabel = "Ethanol %", "Boost Adj." + columnLabel = "Ethanol", "Boost" xAxis = 0, 100, 5 yAxis = -100, 200, 5 - xBins = flexCorrectionBins, flex - yBins = flexCorrectionBoost + xBins = flexBoostBins, flex + yBins = flexBoostAdj ;showTextValues = true [TableEditor] @@ -2277,7 +2279,7 @@ cmdtestspk450dc = "E\x03\x0C" ; you change it. ochGetCommand = "r\$tsCanId\x30%2o%2c" - ochBlockSize = 81 + ochBlockSize = 83 secl = scalar, U08, 0, "sec", 1.000, 0.000 status1 = scalar, U08, 1, "bits", 1.000, 0.000 @@ -2364,6 +2366,7 @@ cmdtestspk450dc = "E\x03\x0C" pulseWidth2 = scalar, U16, 75, "ms", 0.001, 0.000 pulseWidth3 = scalar, U16, 77, "ms", 0.001, 0.000 pulseWidth4 = scalar, U16, 79, "ms", 0.001, 0.000 + flexBoostCor = scalar, S16, 81, "kPa", 1.000, 0.000 #if CELSIUS coolant = { coolantRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives diff --git a/speeduino/auxiliaries.ino b/speeduino/auxiliaries.ino index 3a78670b..a23d4899 100644 --- a/speeduino/auxiliaries.ino +++ b/speeduino/auxiliaries.ino @@ -80,12 +80,16 @@ void boostControl() //If flex fuel is enabled, there can be an adder to the boost target based on ethanol content if( configPage1.flexEnabled == 1 ) { - int16_t boostAdder = flexLookupCache.boost = BIT_CHECK(TIMER_mask, BIT_TIMER_4HZ) || !flexLookupCache.boostReady - ? table2D_getValue(&flexCorrectionBoostTable, currentStatus.ethanolPct) + int16_t boostAdder = currentStatus.flexBoostCorrection = flexLookupCache.boost = BIT_CHECK(TIMER_mask, BIT_TIMER_4HZ) || !flexLookupCache.boostReady + ? table2D_getValue(&flexBoostTable, currentStatus.ethanolPct) : flexLookupCache.boost; currentStatus.boostTarget += boostAdder; } + else + { + currentStatus.flexBoostCorrection = 0; + } if(currentStatus.boostTarget > 0) { @@ -122,7 +126,10 @@ void boostControl() boostDisable(); } } - else { DISABLE_BOOST_TIMER(); } // Disable timer channel + else { // Disable timer channel and zero the flex boost correction status + DISABLE_BOOST_TIMER(); + currentStatus.flexBoostCorrection = 0; + } boostCounter++; } diff --git a/speeduino/comms.h b/speeduino/comms.h index c18ff689..a750d8e4 100644 --- a/speeduino/comms.h +++ b/speeduino/comms.h @@ -12,7 +12,7 @@ #define canbusPage 9//Config Page 9 #define warmupPage 10 //Config Page 10 -#define SERIAL_PACKET_SIZE 81 +#define SERIAL_PACKET_SIZE 83 byte currentPage = 1;//Not the same as the speeduino config page numbers bool isMap = true; diff --git a/speeduino/comms.ino b/speeduino/comms.ino index 5247c772..bb91dd48 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -457,6 +457,9 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum) fullStatus[79] = lowByte(currentStatus.PW4); //Pulsewidth 4 multiplied by 10 in ms. Have to convert from uS to mS. fullStatus[80] = highByte(currentStatus.PW4); //Pulsewidth 4 multiplied by 10 in ms. Have to convert from uS to mS. + fullStatus[81] = lowByte(currentStatus.flexBoostCorrection); + fullStatus[82] = highByte(currentStatus.flexBoostCorrection); + for(byte x=0; x Date: Sat, 20 Jan 2018 18:00:56 -0600 Subject: [PATCH 11/12] significantly improved the flex settings dialog --- reference/speeduino.ini | 52 +++++++++++++---------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 5ac1b5e9..7e2df096 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1151,43 +1151,23 @@ menuDialog = main dialog = flexFueling, "Flex Fuel" field = "Flex sensor", flexEnabled - dialog = flexLeft, "" - field = "Component" - field = "Sensor Frequency" - ;field = "Fuel Adjustment" - ;field = "Additional advance" - ;field = "Additional boost", { boostEnabled } + dialog = flexFuelSettings, "", yAxis + field = "Flex Fuel Sensor ", flexEnabled + field = "Low (E0) ", flexFreqLow, {flexEnabled} + field = "High (E100) ", flexFreqHigh, {flexEnabled} - dialog = flexMiddle, "" - field = "Low (E0)" - field = "", flexFreqLow, { flexEnabled } - ;field = "", flexFuelLow, { flexEnabled && 0 } - ;field = "", flexAdvLow, { flexEnabled && 0 } - ;field = "", flexBoostLow, { boostEnabled } + dialog = flexFuelWest, "", border + panel = flexFuelSettings, North - dialog = flexRight, "" - field = "High (E100)" - field = "", flexFreqHigh, { flexEnabled } - ;field = "", flexFuelHigh, { flexEnabled && 0 } - ;field = "", flexAdvHigh, { flexEnabled && 0 } - ;field = "", flexBoostHigh, { flexEnabled && boostEnabled } - - dialog = flexMain, "Flex Fuel Calibration", xAxis - panel = flexLeft - panel = flexMiddle - panel = flexRight - - dialog = flexFuelTop, "" - field = "Flex Fuel Sensor", flexEnabled - - dialog = flexFueling, "Fuel Sensor Settings", indexCard - topicHelp = "http://speeduino.com/wiki/index.php/Flex_Fuel" - panel = flexFuelTop - panel = flexMain + dialog = flexCurves, "", indexCard panel = flex_fuel_curve, { flexEnabled } panel = flex_adv_curve, { flexEnabled } - panel = flex_boost_curve,{ flexEnabled } - + panel = flex_boost_curve,{ flexEnabled && boostEnabled } + + dialog = flexFueling, "Fuel Sensor Settings", border + topicHelp = "http://speeduino.com/wiki/index.php/Flex_Fuel" + panel = flexFuelWest, West + panel = flexCurves, Center dialog = tacho, "Tacho" field = "Output pin", tachoPin @@ -2001,7 +1981,7 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 255, 10 xBins = flexFuelBins, flex yBins = flexFuelAdj - ;showTextValues = true + size = 400, 200 curve = flex_adv_curve, "Flex Timing Advance" columnLabel = "Ethanol", "Advance" @@ -2009,7 +1989,7 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 100, 5 xBins = flexAdvBins, flex yBins = flexAdvAdj - ;showTextValues = true + size = 400, 200 curve = flex_boost_curve, "Flex Boost Adjustments" columnLabel = "Ethanol", "Boost" @@ -2017,7 +1997,7 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = -100, 200, 5 xBins = flexBoostBins, flex yBins = flexBoostAdj - ;showTextValues = true + size = 400, 200 [TableEditor] ; table_id, map3d_id, "title", page From e1f2b350810922a58256c898c1df44bbc6d35059 Mon Sep 17 00:00:00 2001 From: Murray Date: Sun, 21 Jan 2018 15:19:04 -0600 Subject: [PATCH 12/12] migrated the flex fuel help to the curve editors. fixed bonehead flexEnabled ini mistake --- reference/speeduino.ini | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 0f283fff..6a9133ed 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1012,15 +1012,12 @@ menuDialog = main includeAFR = "When enabled, the current AFR reading is incorporated directly in the pulsewidth calculation as a percentage of the current target ratio. VE table must be retuned when this value is changed. " useExtBaro = "By Default, Speeduino will measure barometric pressure upon startup. Optionally however, a 2nd pressure sensor can be used to perform live barometric readings whilst the system is on." - flexEnabled = "Turns on readings from the Flex sensor and enables the below adjustments" - flexFreqLow = "The frequency of the sensor at 0% ethanol (50Hz for standard GM/Continental sensor)" + flexEnabled = "Turns on readings from the Flex sensor and enables the below adjustments" + flexFreqLow = "The frequency of the sensor at 0% ethanol (50Hz for standard GM/Continental sensor)" flexFreqHigh = "The frequency of the sensor at 100% ethanol (150Hz for standard GM/Continental sensor)" - flexFuelLow = "Fuel % to be used for the lowest ethanol reading (Typically 100%. ie No adjustment)" - flexFuelHigh = "Fuel % to be used for the highest ethanol reading (Typically 163% for 100% ethanol)" - flexAdvLow = "Additional advance (in degrees) at lowest ethanol reading (Typically 0)" - flexAdvHigh = "Additional advance (in degrees) at highest ethanol reading (Typically 10-20 degrees)" - flexBoostHigh = "This amount that will be added to the boost target at E100. Between E0 and E100, the amount added to the boost target will be scaled from 0 to this value" - flexBoostLow = "Typically should be set to 0, but can be used to lower boost at E0 if the bast tune is setup with some ethanol" + flexFuelAdj = "Fuel % to be used for the current ethanol % (Typically 100% @ 0%, 163% @ 100%)" + flexAdvAdj = "Additional advance (in degrees) for the current ethanol % (Typically 0 @ 0%, 10-20 @ 100%)" + flexBoostAdj = "Adjustment, in kPa, to the boost target for the current ethanol %. Negative values are allowed to lower boost at lower ethanol % if necessary." flatSArm = "The RPM switch point that determines whether an eganged clutch is for launch control or flat shift. Below this figure, an engaged clutch is considered to be for launch, above this figure an active clutch input will be considered a flat shift. This should be set at least several hundred RPM above idle" flatSSoftWin= "The number of RPM below the flat shift point where the softlimit will be applied (aka Soft limit window). Recommended values are 200-1000" @@ -1167,26 +1164,23 @@ menuDialog = main panel = engine_constants_east, East # Flex fuel stuff - dialog = flexFueling, "Flex Fuel" - field = "Flex sensor", flexEnabled - dialog = flexFuelSettings, "", yAxis - field = "Flex Fuel Sensor ", { flexEnabled } - field = "Low (E0) ", flexFreqLow, { flexEnabled } - field = "High (E100) ", flexFreqHigh, { flexEnabled } + field = "Flex Fuel Sensor ", flexEnabled + field = "Low (E0) ", flexFreqLow, { flexEnabled } + field = "High (E100) ", flexFreqHigh, { flexEnabled } dialog = flexFuelWest, "", border panel = flexFuelSettings, North dialog = flexCurves, "", indexCard - panel = flex_fuel_curve, { flexEnabled } - panel = flex_adv_curve, { flexEnabled } - panel = flex_boost_curve,{ flexEnabled && boostEnabled } + panel = flex_fuel_curve, { flexEnabled } + panel = flex_adv_curve, { flexEnabled } + panel = flex_boost_curve, { flexEnabled && boostEnabled } dialog = flexFueling, "Fuel Sensor Settings", border topicHelp = "http://speeduino.com/wiki/index.php/Flex_Fuel" panel = flexFuelWest, West - panel = flexCurves, Center + panel = flexCurves, Center dialog = tacho, "Tacho" field = "Output pin", tachoPin