Clean up of debug prints, and safer CAS handling

This commit is contained in:
stevenhowes
2019-05-06 18:01:30 +01:00
parent fad496f152
commit f80968559e
6 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -2,6 +2,7 @@
#include "data.h"
#include "schedule.h"
#include "tables.h"
void(* resetFunc) (void) = 0; //declare reset function @ address 0
void setup() {
// Sensors
@@ -45,4 +46,3 @@ void loop() {
// Run scheduler
schedule_process();
}
-6
View File
@@ -12,10 +12,6 @@ void battery_init()
{
Serial.println("ERR: Battery high");
}
else
{
Serial.println("INF: Battery ok");
}
}
void task_battery_run()
@@ -27,5 +23,3 @@ void task_battery_run()
// Nudge it along so we have an index starting at 0 for tables etc
battery_voltage_index = constrain(battery_voltage_value,7,16) - 7;
}
+6 -4
View File
@@ -56,7 +56,13 @@ void cas_process()
else
{
// Clear it if we're in sync, but don't clear log flag
if(cas_sync_initial == 1)
{
cas_sync_initial = 0;
cas_sync_fail = 0;
cas_sync_fail_log = 0;
}
}
// Use this number because we KNOW it's right
@@ -137,7 +143,3 @@ void cas_process()
}
cas_sgc_lastvalue = sgc;
}
+1 -1
View File
@@ -24,6 +24,7 @@ unsigned long cas_sgc_lastrise = 0; // micros() of the las
unsigned long cas_sgc_lastfall = 0; // "" of the last fall
byte cas_sgc_lastvalue = 0; // The state of SGC on the previous cycle
byte cas_sync_initial = 1;
byte cas_sync_fail = 0; // We lost track of a cylinder
byte cas_sync_fail_log = 0; // We need to output this in debug
@@ -57,4 +58,3 @@ byte throttle_current_value = 0; // Percentage
byte throttle_previous_1_value = 0; // Percentage
byte throttle_previous_2_value = 0; // Percentage
byte throttle_delta = 0; // Difference between current and delta
+9 -1
View File
@@ -17,8 +17,11 @@ void task_debug_run()
{
// Log if we're out of sync timing-wise
if(cas_sync_fail_log > 0)
{
if(cas_sync_initial == 0)
{
Serial.println("ERR: CAS sync fail");
}
cas_sync_fail_log = 0;
}
@@ -138,8 +141,14 @@ void task_debug_run()
}else if(readbyte == 'R') // Enable RPM output
{
debug_rpm = 1;
}else if(readbyte == 'S') // Arduino reset
{
resetFunc();
}
}
// Allow it to re-sync (i.e. reset CAS failure as it was intentional)
cas_sync_initial = 1;
}
// Outputs the fuel table as JSON
@@ -200,4 +209,3 @@ void task_debug_safekill()
cas_sync_fail=1;
cas_sync_fail_log=0;
}
-4
View File
@@ -7,8 +7,6 @@ void map_init()
Serial.println("ERR: MAP low");
else if(map_current_value > 108)
Serial.println("ERR: MAP high ");
else
Serial.println("INF: MAP ok");
}
void task_map_run()
@@ -17,5 +15,3 @@ void task_map_run()
map_current_index = map(map_current_value, map_range_min, map_range_max, 0, 15);
map_current_index = constrain(map_current_index,0,15);
}