diff --git a/include/power.h b/include/power.h index a1033041..12e8c032 100644 --- a/include/power.h +++ b/include/power.h @@ -12,10 +12,10 @@ #define NO_OF_SAMPLES 64 // we do some multisampling to get better values #ifndef BAT_MAX_VOLTAGE -#define BAT_MAX_VOLTAGE 4300 // millivolts +#define BAT_MAX_VOLTAGE 4200 // millivolts #endif #ifndef BAT_MIN_VOLTAGE -#define BAT_MIN_VOLTAGE 3200 // millivolts +#define BAT_MIN_VOLTAGE 2800 // millivolts #endif uint16_t read_voltage(void); diff --git a/platformio.ini b/platformio.ini index 306ec661..93fad964 100644 --- a/platformio.ini +++ b/platformio.ini @@ -45,7 +45,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I [common] ; for release_version use max. 10 chars total, use any decimal format like "a.b.c" -release_version = 1.9.984 +release_version = 1.9.99 ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose debug_level = 3 @@ -57,12 +57,12 @@ platform_espressif32 = espressif32@1.12.0 monitor_speed = 115200 upload_speed = 115200 lib_deps_lora = - MCCI LoRaWAN LMIC library@>=3.1.0 ; MCCI LMIC by Terrill Moore + MCCI LoRaWAN LMIC library@3.1.0 ; MCCI LMIC by Terrill Moore lib_deps_display = - ss_oled@4.1.2 ; simple and small OLED lib by Larry Bank - BitBang_I2C@2.0.2 - QRCode@>=0.0.1 - TFT_eSPI@>=2.2.0 + ss_oled@4.1.2 ; fast and small OLED lib by Larry Bank + BitBang_I2C@2.0.3 + QRCode@0.0.1 + TFT_eSPI@2.2.0 lib_deps_matrix_display = Ultrathin_LED_Matrix@>=1.0.0 lib_deps_rgbled = @@ -110,7 +110,7 @@ framework = arduino board = esp32dev board_build.partitions = min_spiffs.csv upload_speed = ${common.upload_speed} -;upload_port = COM5 +;upload_port = COM8 platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = ${common.build_flags_all} diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 4c89cf72..c98cc7b9 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -69,7 +69,7 @@ #define USE_OTA 1 // set to 0 to disable OTA update #define WIFI_MAX_TRY 5 // maximum number of wifi connect attempts for OTA update [default = 20] #define OTA_MAX_TRY 5 // maximum number of attempts for OTA download and write to flash [default = 3] -#define OTA_MIN_BATT 3600 // minimum battery level for OTA [millivolt] +#define OTA_MIN_BATT 50 // minimum battery level for OTA [percent] #define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds] // settings for syncing time of node with a time source (network / gps / rtc / timeserver) diff --git a/src/power.cpp b/src/power.cpp index 4ab413a1..4d1920c5 100644 --- a/src/power.cpp +++ b/src/power.cpp @@ -224,18 +224,20 @@ uint8_t read_battlevel() { const uint16_t batt_voltage_range = BAT_MAX_VOLTAGE - BAT_MIN_VOLTAGE; const uint8_t batt_level_range = MCMD_DEVS_BATT_MAX - MCMD_DEVS_BATT_MIN + 1; const int batt_voltage = read_voltage() - BAT_MIN_VOLTAGE; - const uint8_t batt_percent = (batt_voltage > 0) - ? (float)batt_voltage / (float)batt_voltage_range * 100.0 - : MCMD_DEVS_BATT_NOINFO; + const uint8_t batt_percent = + (batt_voltage > 0) + ? (float)batt_voltage / (float)batt_voltage_range * 100.0 + : MCMD_DEVS_BATT_NOINFO; uint8_t lmic_batt_level; - ESP_LOGD(TAG, "batt_voltage = %d mV / batt_level = %u%%", batt_voltage, - batt_percent); + ESP_LOGD(TAG, "batt_voltage = %dmV / batt_level = %u%%", + batt_voltage + BAT_MIN_VOLTAGE, batt_percent); if (batt_percent != MCMD_DEVS_BATT_NOINFO) #ifdef HAS_PMU lmic_batt_level = pmu.isVBUSPlug() ? MCMD_DEVS_EXT_POWER - : (float)batt_percent / (float)batt_level_range * 100.0; + : (float)batt_percent / + (float)batt_level_range * 100.0; #else lmic_batt_level = (float)batt_percent / (float)batt_level_range * 100.0; #endif // HAS_PMU