Fix voltage sensor for OBP40
This commit is contained in:
parent
6f4e9b625d
commit
71946248e2
|
@ -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
|
||||
#endif
|
||||
sensors.batteryVoltage = rawVoltage * vslope + voffset; // Calibration
|
||||
#endif
|
||||
// Save new data in average array
|
||||
batV.reading(int(sensors.batteryVoltage * 100));
|
||||
// Calculate the average values for different time lines from integer values
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue