commit
b91f345d25
|
@ -54,7 +54,7 @@
|
||||||
#define TONE3 3500 // 3500Hz
|
#define TONE3 3500 // 3500Hz
|
||||||
#define TONE4 4000 // 4000Hz
|
#define TONE4 4000 // 4000Hz
|
||||||
// Analog Input
|
// Analog Input
|
||||||
#define OBP_ANALOG0 4 // Analog input for voltage power supplay
|
#define OBP_ANALOG0 4 // Analog input for voltage power supply
|
||||||
#define MIN_VOLTAGE 10.0 // Min voltage for under voltage detection (then goto deep sleep)
|
#define MIN_VOLTAGE 10.0 // Min voltage for under voltage detection (then goto deep sleep)
|
||||||
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
|
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
|
||||||
// Touch buttons
|
// Touch buttons
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
#define NUM_FLASH_LED 1 // Number of flash LED
|
#define NUM_FLASH_LED 1 // Number of flash LED
|
||||||
#define OBP_FLASH_LED 7 // GPIO port
|
#define OBP_FLASH_LED 7 // GPIO port
|
||||||
// Backlight LEDs (6x WS2812B)
|
// Backlight LEDs (6x WS2812B)
|
||||||
#define NUM_BACKLIGHT_LED 6 // Numebr of Backlight LEDs
|
#define NUM_BACKLIGHT_LED 6 // Number of Backlight LEDs
|
||||||
#define OBP_BACKLIGHT_LED 15 // GPIO port
|
#define OBP_BACKLIGHT_LED 15 // GPIO port
|
||||||
// Power Rail
|
// Power Rail
|
||||||
#define OBP_POWER_50 5 // 5.0V power rail
|
#define OBP_POWER_50 5 // 5.0V power rail
|
||||||
|
|
|
@ -456,7 +456,7 @@ void sensorTask(void *param){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send supplay voltage value all 1s
|
// Send supply voltage value all 1s
|
||||||
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
|
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
|
||||||
starttime5 = millis();
|
starttime5 = millis();
|
||||||
sensors.batteryVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20
|
sensors.batteryVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20
|
||||||
|
|
|
@ -246,7 +246,7 @@ void underVoltageDetection(GwApi *api, CommonData &common){
|
||||||
// Read settings
|
// Read settings
|
||||||
float vslope = uint(api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asFloat());
|
float vslope = uint(api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asFloat());
|
||||||
float voffset = uint(api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asFloat());
|
float voffset = uint(api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asFloat());
|
||||||
// Read supplay voltage
|
// Read supply voltage
|
||||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // V = 1/20 * Vin
|
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // V = 1/20 * Vin
|
||||||
actVoltage = actVoltage * vslope + voffset;
|
actVoltage = actVoltage * vslope + voffset;
|
||||||
if(actVoltage < MIN_VOLTAGE){
|
if(actVoltage < MIN_VOLTAGE){
|
||||||
|
|
Loading…
Reference in New Issue