commit
0befd7e5d5
@ -12,10 +12,10 @@
|
|||||||
#define NO_OF_SAMPLES 64 // we do some multisampling to get better values
|
#define NO_OF_SAMPLES 64 // we do some multisampling to get better values
|
||||||
|
|
||||||
#ifndef BAT_MAX_VOLTAGE
|
#ifndef BAT_MAX_VOLTAGE
|
||||||
#define BAT_MAX_VOLTAGE 4300 // millivolts
|
#define BAT_MAX_VOLTAGE 4200 // millivolts
|
||||||
#endif
|
#endif
|
||||||
#ifndef BAT_MIN_VOLTAGE
|
#ifndef BAT_MIN_VOLTAGE
|
||||||
#define BAT_MIN_VOLTAGE 3200 // millivolts
|
#define BAT_MIN_VOLTAGE 2800 // millivolts
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t read_voltage(void);
|
uint16_t read_voltage(void);
|
||||||
|
@ -45,7 +45,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; 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!
|
; 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
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 3
|
debug_level = 3
|
||||||
@ -57,12 +57,12 @@ platform_espressif32 = espressif32@1.12.0
|
|||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
lib_deps_lora =
|
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 =
|
lib_deps_display =
|
||||||
ss_oled@4.1.2 ; simple and small OLED lib by Larry Bank
|
ss_oled@4.1.2 ; fast and small OLED lib by Larry Bank
|
||||||
BitBang_I2C@2.0.2
|
BitBang_I2C@2.0.3
|
||||||
QRCode@>=0.0.1
|
QRCode@0.0.1
|
||||||
TFT_eSPI@>=2.2.0
|
TFT_eSPI@2.2.0
|
||||||
lib_deps_matrix_display =
|
lib_deps_matrix_display =
|
||||||
Ultrathin_LED_Matrix@>=1.0.0
|
Ultrathin_LED_Matrix@>=1.0.0
|
||||||
lib_deps_rgbled =
|
lib_deps_rgbled =
|
||||||
@ -110,7 +110,7 @@ framework = arduino
|
|||||||
board = esp32dev
|
board = esp32dev
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
;upload_port = COM5
|
;upload_port = COM8
|
||||||
platform = ${common.platform_espressif32}
|
platform = ${common.platform_espressif32}
|
||||||
lib_deps = ${common.lib_deps_all}
|
lib_deps = ${common.lib_deps_all}
|
||||||
build_flags = ${common.build_flags_all}
|
build_flags = ${common.build_flags_all}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
#define USE_OTA 1 // set to 0 to disable OTA update
|
#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 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_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]
|
#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)
|
// settings for syncing time of node with a time source (network / gps / rtc / timeserver)
|
||||||
|
@ -224,18 +224,20 @@ uint8_t read_battlevel() {
|
|||||||
const uint16_t batt_voltage_range = BAT_MAX_VOLTAGE - BAT_MIN_VOLTAGE;
|
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 uint8_t batt_level_range = MCMD_DEVS_BATT_MAX - MCMD_DEVS_BATT_MIN + 1;
|
||||||
const int batt_voltage = read_voltage() - BAT_MIN_VOLTAGE;
|
const int batt_voltage = read_voltage() - BAT_MIN_VOLTAGE;
|
||||||
const uint8_t batt_percent = (batt_voltage > 0)
|
const uint8_t batt_percent =
|
||||||
? (float)batt_voltage / (float)batt_voltage_range * 100.0
|
(batt_voltage > 0)
|
||||||
: MCMD_DEVS_BATT_NOINFO;
|
? (float)batt_voltage / (float)batt_voltage_range * 100.0
|
||||||
|
: MCMD_DEVS_BATT_NOINFO;
|
||||||
uint8_t lmic_batt_level;
|
uint8_t lmic_batt_level;
|
||||||
|
|
||||||
ESP_LOGD(TAG, "batt_voltage = %d mV / batt_level = %u%%", batt_voltage,
|
ESP_LOGD(TAG, "batt_voltage = %dmV / batt_level = %u%%",
|
||||||
batt_percent);
|
batt_voltage + BAT_MIN_VOLTAGE, batt_percent);
|
||||||
|
|
||||||
if (batt_percent != MCMD_DEVS_BATT_NOINFO)
|
if (batt_percent != MCMD_DEVS_BATT_NOINFO)
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
lmic_batt_level = pmu.isVBUSPlug() ? MCMD_DEVS_EXT_POWER
|
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
|
#else
|
||||||
lmic_batt_level = (float)batt_percent / (float)batt_level_range * 100.0;
|
lmic_batt_level = (float)batt_percent / (float)batt_level_range * 100.0;
|
||||||
#endif // HAS_PMU
|
#endif // HAS_PMU
|
||||||
|
Loading…
Reference in New Issue
Block a user