fixed Warning (for Real this time)
This commit is contained in:
parent
5e6f4b6a84
commit
8d271e9678
@ -23,7 +23,7 @@ typedef enum eEERequest
|
||||
typedef struct Globals_s
|
||||
{
|
||||
char DeviceName[33];
|
||||
char DeviceName_ID[42];
|
||||
char DeviceName_ID[43];
|
||||
tSystem_Status systemStatus = sysStat_Startup;
|
||||
tSystem_Status resumeStatus = sysStat_Startup;
|
||||
eEERequest requestEEAction = EE_IDLE;
|
||||
|
@ -98,7 +98,7 @@ void setup()
|
||||
Serial.print("\n\n\n");
|
||||
|
||||
strcpy(globals.DeviceName, DEVICE_NAME);
|
||||
snprintf(globals.DeviceName_ID, 41, "%s_%08X", globals.DeviceName, ESP.getChipId());
|
||||
snprintf(globals.DeviceName_ID, 42, "%s_%08X", globals.DeviceName, ESP.getChipId());
|
||||
|
||||
pinMode(DIO_FAC_1_TRG, INPUT_PULLUP);
|
||||
pinMode(DIO_FAC_2_TRG, INPUT_PULLUP);
|
||||
@ -323,13 +323,15 @@ void powerMonitorTicker_callback()
|
||||
float current_mA = 0;
|
||||
float busvoltage = 0;
|
||||
float power_mW = 0;
|
||||
int battery_level = 0;
|
||||
|
||||
shuntvoltage = ina219.getShuntVoltage_mV();
|
||||
busvoltage = ina219.getBusVoltage_V();
|
||||
current_mA = ina219.getCurrent_mA();
|
||||
power_mW = ina219.getPower_mW();
|
||||
globals.loadvoltage = busvoltage + (shuntvoltage / 1000);
|
||||
globals.battery_level = map(globals.loadvoltage * 100, 655, 840, 0, 100);
|
||||
battery_level = map(globals.loadvoltage * 100, 655, 840, 0, 100);
|
||||
globals.battery_level = battery_level < 0 ? 0 : battery_level;
|
||||
|
||||
debugV("Battery Level: %d %%", globals.battery_level);
|
||||
debugV("Bus Voltage: %f V", busvoltage);
|
||||
|
Loading…
x
Reference in New Issue
Block a user