battery voltage dísplay

This commit is contained in:
Klaus K Wilting 2018-07-21 23:13:28 +02:00
parent ac65c3e27c
commit 07dbe08833
5 changed files with 14 additions and 10 deletions

View File

@ -11,11 +11,11 @@
; ---> SELECT TARGET PLATFORM HERE! <--- ; ---> SELECT TARGET PLATFORM HERE! <---
[platformio] [platformio]
env_default = generic ;env_default = generic
;env_default = heltec ;env_default = heltec
;env_default = ttgov1 ;env_default = ttgov1
;env_default = ttgov2 ;env_default = ttgov2
;env_default = ttgov21 env_default = ttgov21
;env_default = ttgobeam ;env_default = ttgobeam
;env_default = lopy ;env_default = lopy
;env_default = lopy4 ;env_default = lopy4

View File

@ -7,13 +7,13 @@ static const char TAG[] = "main";
static void print_char_val_type(esp_adc_cal_value_t val_type) { static void print_char_val_type(esp_adc_cal_value_t val_type) {
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) { if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
ESP_LOGI(TAG, ESP_LOGD(TAG,
"ADC characterization based on Two Point values stored in eFuse"); "ADC characterization based on Two Point values stored in eFuse");
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) { } else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
ESP_LOGI(TAG, ESP_LOGD(TAG,
"ADC characterization based on reference voltage stored in eFuse"); "ADC characterization based on reference voltage stored in eFuse");
} else { } else {
ESP_LOGI(TAG, "ADC characterization based on default reference voltage"); ESP_LOGD(TAG, "ADC characterization based on default reference voltage");
} }
} }

View File

@ -112,7 +112,7 @@ void refreshDisplay() {
// update Battery status (line 2) // update Battery status (line 2)
#ifdef HAS_BATTERY_PROBE #ifdef HAS_BATTERY_PROBE
u8x8.setCursor(0, 2); u8x8.setCursor(0, 2);
u8x8.printf("B:%.1fV", read_voltage() / 1000.0); u8x8.printf("B:%.1fV", batt_volt / 1000.0);
#endif #endif
// update GPS status (line 2) // update GPS status (line 2)

View File

@ -40,8 +40,8 @@ typedef struct {
extern configData_t cfg; // current device configuration extern configData_t cfg; // current device configuration
extern char display_line6[], display_line7[]; // screen buffers extern char display_line6[], display_line7[]; // screen buffers
extern uint8_t channel; // wifi channel rotation counter extern uint8_t channel; // wifi channel rotation counter
extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters extern uint16_t macs_total, macs_wifi, macs_ble, batt_volt; // display values
extern std::set<uint16_t> macs; // temp storage for MACs extern std::set<uint16_t> macs; // temp storage for MACs
extern hw_timer_t *channelSwitch, *sendCycle; extern hw_timer_t *channelSwitch, *sendCycle;
extern portMUX_TYPE timerMux; extern portMUX_TYPE timerMux;

View File

@ -30,8 +30,8 @@ licenses. Refer to LICENSE.txt file in repository for more details.
configData_t cfg; // struct holds current device configuration configData_t cfg; // struct holds current device configuration
char display_line6[16], display_line7[16]; // display buffers char display_line6[16], display_line7[16]; // display buffers
uint8_t channel = 0; // channel rotation counter uint8_t channel = 0; // channel rotation counter
uint16_t macs_total = 0, macs_wifi = 0, uint16_t macs_total = 0, macs_wifi = 0, macs_ble = 0,
macs_ble = 0; // MAC counters globals for display batt_volt = 0; // globals for display
hw_timer_t *channelSwitch = NULL, *displaytimer = NULL, hw_timer_t *channelSwitch = NULL, *displaytimer = NULL,
*sendCycle = NULL; // configure hardware timer for cyclic tasks *sendCycle = NULL; // configure hardware timer for cyclic tasks
@ -185,6 +185,10 @@ void sendPayload() {
SendCycleTimerIRQ = 0; SendCycleTimerIRQ = 0;
portEXIT_CRITICAL(&timerMux); portEXIT_CRITICAL(&timerMux);
#ifdef HAS_BATTERY_PROBE
batt_volt = read_voltage();
#endif
// append counter data to payload // append counter data to payload
payload.reset(); payload.reset();
payload.addCount(macs_wifi, cfg.blescan ? macs_ble : 0); payload.addCount(macs_wifi, cfg.blescan ? macs_ble : 0);