fix logging file first row zero values
This commit is contained in:
parent
e31ccb1813
commit
16dfabc6ba
|
@ -81,7 +81,7 @@ bool initLogging() {
|
||||||
|
|
||||||
void loggingLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm& escRear) {
|
void loggingLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm& escRear) {
|
||||||
|
|
||||||
static unsigned long last_datalogging_write=0;
|
static unsigned long last_datalogging_write=loopmillis; //initialize with current time to have first log written after one interval
|
||||||
static boolean logging_headerWritten=false;
|
static boolean logging_headerWritten=false;
|
||||||
|
|
||||||
unsigned long logginginterval=LOGGINGINTERVAL;
|
unsigned long logginginterval=LOGGINGINTERVAL;
|
||||||
|
|
|
@ -269,14 +269,6 @@ void loop() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loggingLoop(loopmillis,escFront,escRear);
|
|
||||||
if (!armed && !statswritten) { //write stats only once when disarmed
|
|
||||||
statswritten=true;
|
|
||||||
writeTrip(loopmillis,escFront,escRear);
|
|
||||||
}
|
|
||||||
if (statswritten && armed) {
|
|
||||||
statswritten=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
leds();
|
leds();
|
||||||
led_update(loopmillis,escFront,escRear); //ws2812 led ring
|
led_update(loopmillis,escFront,escRear); //ws2812 led ring
|
||||||
|
@ -327,6 +319,17 @@ void loop() {
|
||||||
serialCommandLoop(loopmillis,escFront,escRear);
|
serialCommandLoop(loopmillis,escFront,escRear);
|
||||||
|
|
||||||
|
|
||||||
|
//Logging
|
||||||
|
loggingLoop(loopmillis,escFront,escRear);
|
||||||
|
if (!armed && !statswritten) { //write stats only once when disarmed
|
||||||
|
statswritten=true;
|
||||||
|
writeTrip(loopmillis,escFront,escRear);
|
||||||
|
}
|
||||||
|
if (statswritten && armed) {
|
||||||
|
statswritten=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
looptime_duration_min=min(looptime_duration_min,millis()-loopmillis);
|
looptime_duration_min=min(looptime_duration_min,millis()-loopmillis);
|
||||||
looptime_duration_max=max(looptime_duration_max,millis()-loopmillis);
|
looptime_duration_max=max(looptime_duration_max,millis()-loopmillis);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue