Add option for SD logging with external switch
This commit is contained in:
parent
fcde4f795b
commit
c129fa3326
|
@ -1360,7 +1360,7 @@ page = 13
|
|||
onboard_log_trigger_RPM = bits, U08, 117, [3:3], "Disabled", "Enabled"
|
||||
onboard_log_trigger_prot = bits, U08, 117, [4:4], "Disabled", "Enabled"
|
||||
onboard_log_trigger_Vbat = bits, U08, 117, [5:5], "Disabled", "Enabled"
|
||||
onboard_log_trigger_Epin = bits, U08, 117, [6:7], "Disabled", "polling", "toggle" , "INVALID"
|
||||
onboard_log_trigger_Epin = bits, U08, 117, [6:7], "Disabled", "Enabled", "INVALID", "INVALID" ;In future add momentary on/off option
|
||||
onboard_log_tr1_duration = scalar, U16, 118, "s", 1.000, 0.0, 0, 65000, 0
|
||||
onboard_log_tr2_thr_on = scalar, U08, 120, "RPM", 100.0, 0.0, 0, 10000, 0
|
||||
onboard_log_tr2_thr_off = scalar, U08, 121, "RPM", 100.0, 0.0, 0, 10000, 0
|
||||
|
@ -1370,7 +1370,8 @@ page = 13
|
|||
onboard_log_tr3_thr_AFR = bits, U08, 122, [3:3], "Disabled", "Enabled"
|
||||
onboard_log_tr4_thr_on = scalar, U08, 123, "V", 0.1, 0.0, 0.0, 15.90, 2 ; * ( 1 byte)
|
||||
onboard_log_tr4_thr_off = scalar, U08, 124, "V", 0.1, 0.0, 0.0, 14.90, 2 ; * ( 1 byte)
|
||||
onboard_log_tr5_thr_on = scalar, U08, 125, "pin", 1.0, 0.0, 0.0, 255, 0 ;
|
||||
onboard_log_tr5_Epin_pin = bits , U08, 125, [0:5], $IO_Pins_no_def
|
||||
unused13_125_2 = bits , U08, 125, [6:7], ";", ",", "tab", "space"
|
||||
|
||||
unused12_125_127 = array, U08, 126, [2], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
|
||||
|
@ -1658,7 +1659,7 @@ page = 15
|
|||
defaultValue = onboard_log_tr3_thr_AFR, 0
|
||||
defaultValue = onboard_log_tr4_thr_on, 12.5
|
||||
defaultValue = onboard_log_tr4_thr_off, 7.0
|
||||
defaultValue = onboard_log_tr5_thr_on, 0
|
||||
defaultValue = onboard_log_tr5_Epin_pin, 0
|
||||
defaultValue = onboard_log_csv_separator, 0
|
||||
|
||||
;VSS related settings
|
||||
|
@ -2298,7 +2299,7 @@ menuDialog = main
|
|||
onboard_log_tr3_thr_AFR = "When the bits of the AFR engine protection function are set the datalogger is started when no set anymore the logger is stopped"
|
||||
onboard_log_tr4_thr_on = "When the measured battery voltage is above this threshold the datalogger is started"
|
||||
onboard_log_tr4_thr_off = "When the measured battery voltage is below this threshold the datalogger is stopped"
|
||||
onboard_log_tr5_thr_on = "The pin to trigger the datalogger start/stop"
|
||||
onboard_log_tr5_Epin_pin = "The pin to trigger the datalogger start/stop"
|
||||
onboard_log_csv_separator = "Choose what character is used for the CSV separator between fields"
|
||||
|
||||
battVCorMode = "The Battery Voltage Correction value from the table below can either be applied on the whole injection Pulse Width value, or only on the Open Time value."
|
||||
|
@ -4127,10 +4128,6 @@ menuDialog = main
|
|||
field = "Real Time Clock mode", rtc_mode
|
||||
field = "Real Time Clock Trim +/-", rtc_trim, {rtc_mode}
|
||||
|
||||
; dialog = rtc_settings, "Real Time Clock"
|
||||
; panel = rtc_setup
|
||||
; panel = std_ms3Rtc
|
||||
|
||||
dialog = onboard_log_basic_setup, "Log Configuration"
|
||||
field = "Logger type", onboard_log_file_style
|
||||
;field = "CSV separator", onboard_log_csv_separator {onboard_log_file_style == 1}
|
||||
|
@ -4145,13 +4142,18 @@ menuDialog = main
|
|||
field = "On Boot", onboard_log_trigger_boot, {onboard_log_file_style}
|
||||
field = "On Boot log duration", onboard_log_tr1_duration, {onboard_log_file_style && onboard_log_trigger_boot}
|
||||
|
||||
dialog = onboard_log_trigger_RPM, "RPM"
|
||||
dialog = onboard_log_trigger_RPM, "RPM"
|
||||
field = "RPM", onboard_log_trigger_RPM {onboard_log_file_style && !onboard_log_trigger_boot}
|
||||
field = "ON (Min RPM)", onboard_log_tr2_thr_on {onboard_log_file_style && onboard_log_trigger_RPM}
|
||||
field = "OFF (Max RPM)", onboard_log_tr2_thr_off {onboard_log_file_style && onboard_log_trigger_RPM}
|
||||
|
||||
dialog = onboard_log_trigger_prot, "Engine protection"
|
||||
dialog = onboard_log_trigger_prot, "Engine protection"
|
||||
field = "Engine protection", onboard_log_trigger_prot {onboard_log_file_style && !onboard_log_trigger_boot}
|
||||
|
||||
dialog = onboard_log_trigger_Epin, "External Switch"
|
||||
field = "Board pin", onboard_log_trigger_Epin {onboard_log_file_style && !onboard_log_trigger_boot}
|
||||
field = "Pin number", onboard_log_tr5_Epin_pin {onboard_log_file_style && onboard_log_trigger_Epin}
|
||||
|
||||
; field = "RPM", onboard_log_tr3_thr_RPM {onboard_log_file_style && onboard_log_trigger_prot}
|
||||
; field = "MAP", onboard_log_tr3_thr_MAP {onboard_log_file_style && onboard_log_trigger_prot}
|
||||
; field = "Oil", onboard_log_tr3_thr_Oil {onboard_log_file_style && onboard_log_trigger_prot}
|
||||
|
@ -4162,9 +4164,6 @@ menuDialog = main
|
|||
; field = "ON threshold", onboard_log_tr4_thr_on {onboard_log_file_style && onboard_log_trigger_Vbat}
|
||||
; field = "OFF threshold", onboard_log_tr4_thr_off {onboard_log_file_style && onboard_log_trigger_Vbat}
|
||||
|
||||
; dialog = onboard_log_trigger_Epin, "Board pin"
|
||||
; field = "Board pin", onboard_log_trigger_Epin {onboard_log_file_style&& !onboard_log_trigger_boot}
|
||||
; field = "Pin number", onboard_log_tr5_thr_on {onboard_log_file_style && onboard_log_trigger_Epin}
|
||||
|
||||
dialog = rtc_settings, "Real Time Clock"
|
||||
field = "Mode", rtc_mode
|
||||
|
@ -4175,6 +4174,7 @@ menuDialog = main
|
|||
;field = "Above RPM", onboard_log_trigger_RPM
|
||||
panel = onboard_log_trigger_RPM
|
||||
panel = onboard_log_trigger_prot
|
||||
panel = onboard_log_trigger_Epin
|
||||
;field = "With battery", onboard_log_trigger_Vbat
|
||||
|
||||
dialog = onboard_log_setup, "On-board logger", border
|
||||
|
|
|
@ -356,9 +356,12 @@ void checkForSDStart()
|
|||
|
||||
}
|
||||
|
||||
if(( configPage13.onboard_log_trigger_Epin) && (SD_status == SD_STATUS_READY) )
|
||||
if((configPage13.onboard_log_trigger_Epin) && (SD_status == SD_STATUS_READY) )
|
||||
{
|
||||
|
||||
if(digitalRead(pinSDEnable) == LOW }
|
||||
{
|
||||
beginSDLogging(); //Setup the log file, preallocation, header row
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,6 +375,7 @@ void checkForSDStop()
|
|||
bool log_RPM = false;
|
||||
bool log_prot = false;
|
||||
bool log_Vbat = false;
|
||||
bool log_Epin = false;
|
||||
|
||||
//Logging only needs to be stopped if already active
|
||||
if(SD_status == SD_STATUS_ACTIVE)
|
||||
|
@ -404,8 +408,17 @@ void checkForSDStop()
|
|||
|
||||
}
|
||||
|
||||
//External Pin
|
||||
if(configPage13.onboard_log_trigger_Epin)
|
||||
{
|
||||
if(digitalRead(pinSDEnable) == LOW)
|
||||
{
|
||||
log_Epin = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Check all conditions to see if we should stop logging
|
||||
if( (log_boot == false) && (log_RPM == false) && (log_prot == false) && (log_Vbat == false) && (manualLogActive == false) )
|
||||
if( (log_boot == false) && (log_RPM == false) && (log_prot == false) && (log_Vbat == false) && (log_Epin == false) && (manualLogActive == false) )
|
||||
{
|
||||
endSDLogging(); //Setup the log file, preallocation, header row
|
||||
}
|
||||
|
|
|
@ -1428,10 +1428,11 @@ struct config13 {
|
|||
byte onboard_log_tr3_thr_AFR :1; // "Disabled", "Enabled"
|
||||
byte onboard_log_tr4_thr_on; // "V", 0.1, 0.0, 0.0, 15.90, 2 ; * ( 1 byte)
|
||||
byte onboard_log_tr4_thr_off; // "V", 0.1, 0.0, 0.0, 15.90, 2 ; * ( 1 byte)
|
||||
byte onboard_log_tr5_thr_on; // "pin", 0, 0, 0, 1, 255, 0 ;
|
||||
byte onboard_log_tr5_Epin_pin :6; // "pin", 0, 0, 0, 1, 255, 0 ;
|
||||
byte unused13_125_2 :2;
|
||||
|
||||
|
||||
byte unused12_125_127[2];
|
||||
byte unused12_126_127[2];
|
||||
|
||||
#if defined(CORE_AVR)
|
||||
};
|
||||
|
@ -1532,6 +1533,7 @@ extern byte pinWMIIndicator; // No water indicator bulb
|
|||
extern byte pinWMIEnabled; // ON-OFF output to relay/pump/solenoid
|
||||
extern byte pinMC33810_1_CS;
|
||||
extern byte pinMC33810_2_CS;
|
||||
extern byte pinSDEnable; //Input for manually enabling SD logging
|
||||
#ifdef USE_SPI_EEPROM
|
||||
extern byte pinSPIFlash_CS;
|
||||
#endif
|
||||
|
|
|
@ -246,6 +246,7 @@ byte pinWMIIndicator; // No water indicator bulb
|
|||
byte pinWMIEnabled; // ON-OFF output to relay/pump/solenoid
|
||||
byte pinMC33810_1_CS;
|
||||
byte pinMC33810_2_CS;
|
||||
byte pinSDEnable;
|
||||
#ifdef USE_SPI_EEPROM
|
||||
byte pinSPIFlash_CS;
|
||||
#endif
|
||||
|
|
|
@ -2617,8 +2617,11 @@ void setPinMapping(byte boardID)
|
|||
if ( (configPage10.wmiIndicatorPin != 0) && (configPage10.wmiIndicatorPin < BOARD_MAX_IO_PINS) ) { pinWMIIndicator = pinTranslate(configPage10.wmiIndicatorPin); }
|
||||
if ( (configPage10.wmiEnabledPin != 0) && (configPage10.wmiEnabledPin < BOARD_MAX_IO_PINS) ) { pinWMIEnabled = pinTranslate(configPage10.wmiEnabledPin); }
|
||||
if ( (configPage10.vvt2Pin != 0) && (configPage10.vvt2Pin < BOARD_MAX_IO_PINS) ) { pinVVT_2 = pinTranslate(configPage10.vvt2Pin); }
|
||||
if ( (configPage13.onboard_log_trigger_Epin != 0 ) && (configPage13.onboard_log_trigger_Epin != 0) && (configPage13.onboard_log_tr5_Epin_pin < BOARD_MAX_IO_PINS) ) { pinSDEnable = pinTranslate(configPage13.onboard_log_tr5_Epin_pin); }
|
||||
|
||||
|
||||
//Currently there's no default pin for Idle Up
|
||||
|
||||
pinIdleUp = pinTranslate(configPage2.idleUpPin);
|
||||
|
||||
//Currently there's no default pin for Idle Up Output
|
||||
|
@ -2819,6 +2822,10 @@ void setPinMapping(byte boardID)
|
|||
{
|
||||
pinMode(pinOilPressure, INPUT);
|
||||
}
|
||||
if( (configPage13.onboard_log_trigger_Epin > 0) && (!pinIsOutput(pinSDEnable)) )
|
||||
{
|
||||
pinMode(pinSDEnable, INPUT);
|
||||
}
|
||||
if(configPage10.wmiEnabled > 0)
|
||||
{
|
||||
pinMode(pinWMIEnabled, OUTPUT);
|
||||
|
|
|
@ -600,7 +600,7 @@ void doUpdates()
|
|||
configPage13.onboard_log_tr3_thr_AFR = 0;
|
||||
configPage13.onboard_log_tr4_thr_on = 0;
|
||||
configPage13.onboard_log_tr4_thr_off = 0;
|
||||
configPage13.onboard_log_tr5_thr_on = 0;
|
||||
configPage13.onboard_log_tr5_Epin_pin = 0;
|
||||
|
||||
writeAllConfig();
|
||||
storeEEPROMVersion(19);
|
||||
|
|
Loading…
Reference in New Issue