diff --git a/lib/obp60task/OBPSensorTask.cpp b/lib/obp60task/OBPSensorTask.cpp index 311da1c..31c754c 100644 --- a/lib/obp60task/OBPSensorTask.cpp +++ b/lib/obp60task/OBPSensorTask.cpp @@ -498,14 +498,18 @@ void sensorTask(void *param){ // Send supply voltage value all 1s if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){ starttime5 = millis(); - float rawVoltage = 0; - #if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR) + float rawVoltage = 0; // Default value + #ifdef BOARD_OBP40S3 + sensors.batteryVoltage = 0; // If no sensor then zero voltage + #endif + #if defined(BOARD_OBP40S3) && defined(VOLTAGE_SENSOR) rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40 + sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration #endif #ifdef BOARD_OBP60S3 - rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60 + rawVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60 + sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration #endif - sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration // Save new data in average array batV.reading(int(sensors.batteryVoltage * 100)); // Calculate the average values for different time lines from integer values diff --git a/lib/obp60task/PageVoltage.cpp b/lib/obp60task/PageVoltage.cpp index 2aab416..cfd784e 100644 --- a/lib/obp60task/PageVoltage.cpp +++ b/lib/obp60task/PageVoltage.cpp @@ -187,7 +187,6 @@ public: } // Logging voltage value - if (raw == 0) return; LOG_DEBUG(GwLog::LOG,"Drawing at PageVoltage, Type:%s %s:=%f", batType, name1.c_str(), raw); // Draw page diff --git a/lib/obp60task/debugging.txt b/lib/obp60task/debugging.txt new file mode 100644 index 0000000..c0a22e0 --- /dev/null +++ b/lib/obp60task/debugging.txt @@ -0,0 +1,6 @@ +Debugging tool +############## + +log.txt = text file with error messages from terminal console + +tools/decoder.py -p ESP32S3 -t ~/.platformio/packages/toolchain-xtensa-esp32s3/ -e .pio/build/obp60_s3/firmware.elf log.txt \ No newline at end of file