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).
This commit is contained in:
Murray 2018-01-12 21:37:21 -06:00
parent 81d8ccd358
commit 2819adb865
4 changed files with 23 additions and 4 deletions

View File

@ -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
;-------------------------------------------------------------------------------

View File

@ -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

View File

@ -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;

View File

@ -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); }