From 55bc85636c0da9c4e0920306e4cd3141eb180526 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Wed, 27 Apr 2022 08:26:30 +0200 Subject: [PATCH 01/17] fix #858: temporary disabled oled assert --- src/display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display.cpp b/src/display.cpp index 99642ab4..49e2895e 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -66,7 +66,7 @@ void dp_setup(int contrast) { MY_DISPLAY_INVERT, USE_HW_I2C, MY_DISPLAY_SDA, MY_DISPLAY_SCL, MY_DISPLAY_RST, OLED_FREQUENCY); // use standard I2C bus at 400Khz - _ASSERT(rc != OLED_NOT_FOUND); + //_ASSERT(rc != OLED_NOT_FOUND); // set display buffer obdSetBackBuffer(&ssoled, displaybuf); From 00dde4583e0b37211fb971c8d3f460efa733d79c Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 29 Apr 2022 15:41:41 +0200 Subject: [PATCH 02/17] lib update arduino-esp32 v2.0.2 --- platformio_orig.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index c66c138b..b19de32c 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -14,10 +14,10 @@ ;halfile = ttgov1.h ;halfile = ttgov2.h ;halfile = ttgov21old.h -;halfile = ttgov21new.h +halfile = ttgov21new.h ;halfile = ttgofox.h ;halfile = ttgobeam.h -halfile = ttgobeam10.h +;halfile = ttgobeam10.h ;halfile = ttgotdisplay.h ;halfile = ttgotwristband.h ;halfile = fipy.h @@ -54,14 +54,14 @@ extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@4.1.0 +platform_espressif32 = espressif32@4.2.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file lib_deps_lora = mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1 lib_deps_display = - bitbank2/OneBitDisplay @ ^1.11.0 + bitbank2/OneBitDisplay @ ^2.0.0 ricmoo/QRCode @ ^0.0.1 bodmer/TFT_eSPI @ ^2.3.84 lib_deps_ledmatrix = From a02bd850fc1a62f5072a3f16699174da6edcb7a3 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Mon, 2 May 2022 14:45:12 +0200 Subject: [PATCH 03/17] downgrade onebitdisplay lib to 1.11.0 --- platformio_orig.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index b19de32c..f1eba0cb 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -61,7 +61,7 @@ display_library = ; set by build.py and taken from hal file lib_deps_lora = mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1 lib_deps_display = - bitbank2/OneBitDisplay @ ^2.0.0 + bitbank2/OneBitDisplay @ ^1.11.0 ricmoo/QRCode @ ^0.0.1 bodmer/TFT_eSPI @ ^2.3.84 lib_deps_ledmatrix = From 5cc2f13dd7f3f66ad3c7dfeb9bd3502d025aa2bb Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 3 Jun 2022 11:59:48 +0200 Subject: [PATCH 04/17] update platformio esp32 platform 4.4.0 --- platformio_orig.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index f1eba0cb..003814b6 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -54,7 +54,7 @@ extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@4.2.0 +platform_espressif32 = espressif32@4.4.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file From 286c645a692830e9a413bf8860acfb0a1e8484f4 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 3 Jun 2022 12:00:04 +0200 Subject: [PATCH 05/17] bugfix log tag --- lib/BintrayClient/src/BintrayClient.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/BintrayClient/src/BintrayClient.cpp b/lib/BintrayClient/src/BintrayClient.cpp index 55af3f9f..a9796e3a 100644 --- a/lib/BintrayClient/src/BintrayClient.cpp +++ b/lib/BintrayClient/src/BintrayClient.cpp @@ -21,6 +21,9 @@ #include "BintrayClient.h" +// Local logging tag +static const char TAG[] = __FILE__; + BintrayClient::BintrayClient(const String &user, const String &repository, const String &package) : m_user(user), m_repo(repository), m_package(package), m_storage_host("pax.express"), From 30b56c8bcffd654885735ecf97f392369ae09308 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 3 Jun 2022 12:00:58 +0200 Subject: [PATCH 06/17] fix issue #870 --- src/i2c.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/i2c.cpp b/src/i2c.cpp index cc13910f..1d7a3dd7 100644 --- a/src/i2c.cpp +++ b/src/i2c.cpp @@ -38,14 +38,6 @@ void i2c_scan(void) { BBI2C bbi2c; - const char *szNames[] = { - "Unknown", "SSD1306", "SH1106", "VL53L0X", "BMP180", "BMP280", - "BME280", "MPU-60x0", "MPU-9250", "MCP9808", "LSM6DS3", "ADXL345", - "ADS1115", "MAX44009", "MAG3110", "CCS811", "HTS221", "LPS25H", - "LSM9DS1", "LM8330", "DS3231", "LIS3DH", "LIS3DSH", "INA219", - "SHT3X", "HDC1080", "MPU6886", "BME680", "AXP202", "AXP192", - "24AA02XEXX", "DS1307"}; - ESP_LOGI(TAG, "Starting I2C bus scan..."); memset(&bbi2c, 0, sizeof(bbi2c)); @@ -58,6 +50,8 @@ void i2c_scan(void) { uint8_t map[16]; uint8_t i; int iDevice, iCount; + uint32_t iDevCapab; + char szName[15]; I2CScan(&bbi2c, map); // get bitmap of connected I2C devices if (map[0] == 0xfe) // something is wrong with the I2C bus @@ -72,9 +66,10 @@ void i2c_scan(void) { if (map[i >> 3] & (1 << (i & 7))) // device found { iCount++; - iDevice = I2CDiscoverDevice(&bbi2c, i); + iDevice = I2CDiscoverDevice(&bbi2c, i, &iDevCapab); + I2CGetDeviceName(iDevice, szName); ESP_LOGI(TAG, "Device found at 0x%X, type = %s", i, - szNames[iDevice]); // show the device name as a string + szName); // show the device name as a string } } // for i ESP_LOGI(TAG, "%u I2C device(s) found", iCount); From 38b97f72f48529fdfdcecefe1c064c7b4bd6cce3 Mon Sep 17 00:00:00 2001 From: Maximilian Mewes <45098772+itCarl@users.noreply.github.com> Date: Sat, 25 Jun 2022 22:32:09 +0200 Subject: [PATCH 07/17] fix typo 'bei' [GER] to 'by' [ENG] in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4cdf2f2d..5eaabb8c 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Edit `platformio_orig.ini` and select desired hardware target in section boards. ## paxcounter.conf Edit `src/paxcounter_orig.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Copy or rename to `src/paxcounter.conf`. -If your device has a **real time clock** it can be updated bei either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`. +If your device has a **real time clock** it can be updated by either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`. ## src/lmic_config.h Edit `src/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN. From b4d7ddb838aefc0debd09802af1f2e35b6e3d7e6 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 9 Jul 2022 20:08:34 +0200 Subject: [PATCH 08/17] v3.2.2 (based on platformio-espressif32 5.0.0) --- platformio_orig.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 003814b6..0ada2b1a 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -46,7 +46,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 = 3.2.1 +release_version = 3.2.2 ; 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 @@ -54,7 +54,7 @@ extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@4.4.0 +platform_espressif32 = espressif32@5.0.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file From be99c712d70504e368822fe05d695008b0403db1 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 15:47:31 +0200 Subject: [PATCH 09/17] power.cpp: fix HAS_BUTTON if no button --- src/power.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/power.cpp b/src/power.cpp index 4ac70f4e..61e6416c 100644 --- a/src/power.cpp +++ b/src/power.cpp @@ -64,10 +64,12 @@ void AXP192_powerevent_IRQ(void) { pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ); } +#ifdef HAS_BUTTON // short press -> esp32 deep sleep mode, can be exited by pressing user button if (pmu.isPEKShortPressIRQ()) { enter_deepsleep(0, HAS_BUTTON); } +#endif // long press -> shutdown power, can be exited by another longpress if (pmu.isPEKLongtPressIRQ()) { From 0d0928c5a835807c3b368eeb383c4c03e0fe5a69 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 15:52:52 +0200 Subject: [PATCH 10/17] bugfix uptime() rollover --- src/reset.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reset.cpp b/src/reset.cpp index b67d8dae..f62cb54b 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -200,9 +200,9 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { // time stamp sleep start time and save system monotonic time. Deep sleep. gettimeofday(&RTC_sleep_start_time, NULL); - RTC_millis += millis(); + RTC_millis += esp_timer_get_time() / 1000; ESP_LOGI(TAG, "Going to sleep, good bye."); esp_deep_sleep_start(); } -unsigned long long uptime() { return (RTC_millis + millis()); } \ No newline at end of file +unsigned long long uptime() { return (RTC_millis + esp_timer_get_time() / 1000); } \ No newline at end of file From 739fecfc98ea894d35334ab1008729b36a31aeff Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 17:46:21 +0200 Subject: [PATCH 11/17] m5fire.h: remove redundant BOARD_HAS_PSRAM --- src/hal/m5fire.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hal/m5fire.h b/src/hal/m5fire.h index 8cf4e097..b83de54a 100644 --- a/src/hal/m5fire.h +++ b/src/hal/m5fire.h @@ -29,7 +29,6 @@ #define SDCARD_SCLK SCK #define CFG_sx1276_radio 1 // select LoRa chip -#define BOARD_HAS_PSRAM // use if board has external PSRAM #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #define HAS_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet From e09758926769ae250f1392dcac196b7498b9dd2e Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 18:07:39 +0200 Subject: [PATCH 12/17] oled lib release migration --- include/display.h | 29 ++++-- src/display.cpp | 253 ++++++++++++++++++++-------------------------- src/ota.cpp | 6 +- 3 files changed, 135 insertions(+), 153 deletions(-) diff --git a/include/display.h b/include/display.h index 70187893..bb509406 100644 --- a/include/display.h +++ b/include/display.h @@ -14,14 +14,17 @@ #endif #define DISPLAY_PAGES (7) // number of paxcounter display pages +#define PLOTBUFFERSIZE (MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8) // settings for OLED display library #if (HAS_DISPLAY) == 1 -#define MY_FONT_SMALL FONT_SMALL -#define MY_FONT_NORMAL FONT_NORMAL -#define MY_FONT_LARGE FONT_LARGE -#define MY_FONT_STRETCHED FONT_STRETCHED -#define USE_BACKBUFFER 1 +#define MY_FONT_SMALL FONT_6x8 +#define MY_FONT_NORMAL FONT_8x8 +#define MY_FONT_LARGE FONT_16x32 +#define MY_FONT_STRETCHED FONT_12x16 + +#define MY_DISPLAY_FIRSTLINE 30 + #ifdef MY_DISPLAY_ADDR #define OLED_ADDR MY_DISPLAY_ADDR #else @@ -33,6 +36,12 @@ #ifndef OLED_FREQUENCY #define OLED_FREQUENCY 400000L #endif +#ifndef MY_DISPLAY_FGCOLOR +#define MY_DISPLAY_FGCOLOR OLED_WHITE +#endif +#ifndef MY_DISPLAY_BGCOLOR +#define MY_DISPLAY_BGCOLOR OLED_BLACK +#endif // settings for TFT display library #elif (HAS_DISPLAY == 2) @@ -42,6 +51,8 @@ #define MY_FONT_LARGE 4 #define MY_FONT_STRETCHED 6 +#define MY_DISPLAY_FIRSTLINE 30 + #ifndef MY_DISPLAY_FGCOLOR #define MY_DISPLAY_FGCOLOR TFT_WHITE #endif @@ -76,7 +87,7 @@ const uint8_t QR_SCALEFACTOR = (MY_DISPLAY_HEIGHT - 4) / 29; // 4px borderlines -extern uint8_t DisplayIsOn, displaybuf[]; +extern uint8_t DisplayIsOn; extern hw_timer_t *displayIRQ; extern uint8_t volatile channel; // wifi channel rotation counter @@ -86,11 +97,11 @@ void dp_init(bool verbose = false); void dp_shutdown(void); void dp_message(const char *msg, int line, bool invers); void dp_drawPage(bool nextpage); -void dp_println(int lines = 1); +void dp_println(void); void dp_printf(const char *format, ...); void dp_setFont(int font, int inv = 0); -void dp_dump(uint8_t *pBuffer); -void dp_setTextCursor(int col, int row); +void dp_dump(uint8_t *pBuffer = NULL); +void dp_setTextCursor(int col = 0, int row = MY_DISPLAY_FIRSTLINE); void dp_contrast(uint8_t contrast); void dp_clear(void); void dp_power(uint8_t screenon); diff --git a/src/display.cpp b/src/display.cpp index 49e2895e..22766ba2 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -8,11 +8,11 @@ Display-Mask (128 x 64 pixel): | 11111111112 |012345678901234567890 Font ----------------------- --------- -0|PAX:aabbccdd STRETCHED -1|PAX:aabbccdd STRETCHED +0|PAX:aabbccdd LARGE +1|PAX:aabbccdd LARGE 2| 3|WIFI:abcde BLTH:abcde SMALL -4|B:a.bcV Sats:ab ch:ab SMALL +4|Batt:abc% chan:ab SMALL 5|RLIM:abcd Mem:abcdKB SMALL 6|27.Feb 2019 20:27:00* SMALL 7|yyyyyyyyyyyyy xx SFab SMALL @@ -25,9 +25,10 @@ y = LMIC event message xx = payload sendqueue length ab = LMIC spread factor -MY_FONT_SMALL: 6x8px = 21 chars / line -MY_FONT_NORMAL: 8x8px = 16 chars / line -MY_FONT_STRETCHED: 16x32px = 8 chars / line +MY_FONT_SMALL: 6x8px = 21 chars / line @ 8 lines +MY_FONT_NORMAL: 8x8px = 16 chars / line @ 8 lines +MY_FONT_STRETCHED: 12x16px = 10 chars / line @ 4 lines +MY_FONT_LARGE: 16x32px = 8 chars / line @ 2 lines */ @@ -39,18 +40,14 @@ MY_FONT_STRETCHED: 16x32px = 8 chars / line // local Tag for logging static const char TAG[] = __FILE__; +static uint8_t plotbuf[PLOTBUFFERSIZE] = {0}; uint8_t DisplayIsOn = 0; -uint8_t displaybuf[MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8] = {0}; -static uint8_t plotbuf[MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8] = {0}; -static int dp_row = 0, dp_col = 0, dp_font = 0; - hw_timer_t *displayIRQ = NULL; - QRCode qrcode; #ifdef HAS_DISPLAY #if (HAS_DISPLAY) == 1 -OBDISP ssoled; +ONE_BIT_DISPLAY oled; #elif (HAS_DISPLAY) == 2 TFT_eSPI tft = TFT_eSPI(MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT); #else @@ -62,16 +59,11 @@ void dp_setup(int contrast) { #if (HAS_DISPLAY) == 1 // I2C OLED - int rc = obdI2CInit(&ssoled, OLED_TYPE, OLED_ADDR, MY_DISPLAY_FLIP, - MY_DISPLAY_INVERT, USE_HW_I2C, MY_DISPLAY_SDA, - MY_DISPLAY_SCL, MY_DISPLAY_RST, - OLED_FREQUENCY); // use standard I2C bus at 400Khz - //_ASSERT(rc != OLED_NOT_FOUND); - - // set display buffer - obdSetBackBuffer(&ssoled, displaybuf); - obdSetTextWrap(&ssoled, true); - dp_font = MY_FONT_NORMAL; + oled.I2Cbegin(OLED_TYPE, OLED_ADDR, OLED_FREQUENCY); + assert(oled.allocBuffer()); // render all outputs to lib internal backbuffer + oled.setTextWrap(false); + oled.setRotation( + MY_DISPLAY_FLIP ? 2 : 0); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 280° #elif (HAS_DISPLAY) == 2 // SPI TFT @@ -118,7 +110,7 @@ void dp_init(bool verbose) { (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "int." : "ext."); // give user some time to read or take picture - dp_dump(displaybuf); + dp_dump(); delay(2000); dp_clear(); #endif // VERBOSE @@ -136,17 +128,17 @@ void dp_init(bool verbose) { // display DEVEUI as plain text on the right const int x_offset = QR_SCALEFACTOR * 29 + 14; - dp_setTextCursor(x_offset, 0); dp_setFont(MY_FONT_NORMAL); - dp_printf("DEVEUI"); + dp_setTextCursor(x_offset, 0); + dp_printf("DEVEUI:"); dp_println(); for (uint8_t i = 0; i <= 3; i++) { - dp_setTextCursor(x_offset, i + 3); + dp_setTextCursor(x_offset, i * 8 + 20); dp_printf("%4.4s", deveui + i * 4); } // give user some time to read or take picture - dp_dump(displaybuf); + dp_dump(); #if !(BOOTMENU) delay(8000); #endif @@ -198,10 +190,6 @@ void dp_drawPage(bool nextpage) { time_t now; struct tm timeinfo = {0}; -#if (HAS_GPS) - static bool wasnofix = true; -#endif - if (nextpage) { DisplayPage = (DisplayPage >= DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1); dp_clear(); @@ -215,9 +203,9 @@ void dp_drawPage(bool nextpage) { // line 1/2: pax counter // display number of unique macs total Wifi + BLE - if (DisplayPage < 5) { - dp_setFont(MY_FONT_STRETCHED); - dp_printf("%-5d", count.pax); + if (DisplayPage < 3) { + dp_setFont(MY_FONT_LARGE); + dp_printf("%-8d", count.pax); } switch (DisplayPage) { @@ -233,8 +221,8 @@ void dp_drawPage(bool nextpage) { // ---------- page 0: parameters overview ---------- case 0: - dp_setTextCursor(0, 3); dp_setFont(MY_FONT_SMALL); + dp_setTextCursor(); // line 3: wifi + bluetooth counters // WIFI:abcde BLTH:abcde @@ -266,21 +254,13 @@ void dp_drawPage(bool nextpage) { // B:a.bcV Sats:ab ch:ab #if (defined BAT_MEASURE_ADC || defined HAS_PMU || defined HAS_IP5306) if (batt_level == 0) - dp_printf("No batt "); + dp_printf("No batt "); else - dp_printf("B:%3d%% ", batt_level); + dp_printf("Batt:%3u%% ", batt_level); #else - dp_printf(" "); + dp_printf(" "); #endif - -#if (HAS_GPS) - dp_setFont(MY_FONT_SMALL, !gps_hasfix()); - dp_printf("Sats:%.2d", gps.satellites.value()); - dp_setFont(MY_FONT_SMALL); -#else - dp_printf(" "); -#endif - dp_printf(" ch:%02d", channel); + dp_printf("chan:%02u", channel); dp_println(); // line 5: RSSI limiter + free memory @@ -322,7 +302,7 @@ void dp_drawPage(bool nextpage) { dp_setFont(MY_FONT_SMALL, 0); #endif // HAS_LORA - dp_dump(displaybuf); + dp_dump(); break; // ---------- page 1: lorawan parameters ---------- @@ -337,7 +317,7 @@ void dp_drawPage(bool nextpage) { // 7|SNR:-0000 RSSI:-0000 dp_setFont(MY_FONT_SMALL); - dp_setTextCursor(0, 3); + dp_setTextCursor(); dp_printf("Net:%06X Pwr:%-2d", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); dp_println(); dp_printf("Dev:%08X DR:%1d", LMIC.devaddr, LMIC.datarate); @@ -349,7 +329,7 @@ void dp_drawPage(bool nextpage) { dp_println(); dp_printf("SNR:%-5d RSSI:%-5d", (LMIC.snr + 2) / 4, LMIC.rssi); - dp_dump(displaybuf); + dp_dump(); break; #else // flip page if we are unattended DisplayPage++; @@ -359,31 +339,22 @@ void dp_drawPage(bool nextpage) { case 2: #if (HAS_GPS) + + // show satellite status at bottom line + dp_setFont(MY_FONT_SMALL); + dp_setTextCursor(0, 56); + dp_printf("%u Sats", gps.satellites.value()); + dp_printf(gps_hasfix() ? " " : " - No fix"); + + // show latitude and longitude dp_setFont(MY_FONT_STRETCHED); - dp_setTextCursor(0, 3); - if (gps_hasfix()) { - // line 5: clear "No fix" - if (wasnofix) { - dp_setTextCursor(2, 4); - dp_printf(" "); - wasnofix = false; - } - // line 3-4: GPS latitude - dp_printf("%c%07.4f", gps.location.rawLat().negative ? 'S' : 'N', - gps.location.lat()); - - // line 6-7: GPS longitude - dp_printf("%c%07.4f", gps.location.rawLng().negative ? 'W' : 'E', - gps.location.lng()); - - } else { - dp_setTextCursor(2, 4); - dp_setFont(MY_FONT_STRETCHED, 1); - dp_printf("No fix"); - wasnofix = true; - } - - dp_dump(displaybuf); + dp_setTextCursor(); + dp_printf("%c%09.6f", gps.location.rawLat().negative ? 'S' : 'N', + gps.location.lat()); + dp_println(); + dp_printf("%c%09.6f", gps.location.rawLng().negative ? 'W' : 'E', + gps.location.lng()); + dp_dump(); break; #else // flip page if we are unattended DisplayPage++; @@ -394,25 +365,17 @@ void dp_drawPage(bool nextpage) { #if (HAS_BME) dp_setFont(MY_FONT_STRETCHED); - dp_setTextCursor(0, 2); - - // line 2-3: Temp - dp_printf("TMP:%-2.1f", bme_status.temperature); - dp_println(2); - - // line 4-5: Hum - dp_printf("HUM:%-2.1f", bme_status.humidity); - dp_println(2); - + dp_setTextCursor(0, 0); + dp_printf("TMP: %-6.1f", bme_status.temperature); + dp_println(); + dp_printf("HUM: %-6.1f", bme_status.humidity); + dp_println(); + dp_printf("PRE: %-6.1f", bme_status.pressure); #ifdef HAS_BME680 - // line 6-7: IAQ - dp_printf("IAQ:%-3.0f", bme_status.iaq); -#else // is BME280 or BMP180 - // line 6-7: Pre - dp_printf("PRE:%-2.1f", bme_status.pressure); -#endif // HAS_BME680 - - dp_dump(displaybuf); + dp_println(); + dp_printf("IAQ: %-6.0f", bme_status.iaq); +#endif + dp_dump(); break; // page 3 #else // flip page if we are unattended DisplayPage++; @@ -421,20 +384,26 @@ void dp_drawPage(bool nextpage) { // ---------- page 4: time ---------- case 4: - dp_setFont(MY_FONT_LARGE); - dp_setTextCursor(0, 4); time(&now); localtime_r(&now, &timeinfo); strftime(strftime_buf, sizeof(strftime_buf), "%T", &timeinfo); - dp_printf("%.8s", strftime_buf); - dp_dump(displaybuf); + dp_setFont(MY_FONT_STRETCHED); + dp_setTextCursor(0, 0); + dp_printf("Timeofday:"); + dp_setTextCursor(0, 26); + dp_setFont(MY_FONT_LARGE); + dp_printf("%.8s", strftime_buf); + dp_println(); + dp_setFont(MY_FONT_SMALL); + dp_printf("%21.1f", uptime() / 1000.0); + dp_dump(); break; // ---------- page 5: pax graph ---------- case 5: - // update histogram + // update and show histogram dp_plotCurve(count.pax, false); dp_dump(plotbuf); break; @@ -455,35 +424,33 @@ void dp_drawPage(bool nextpage) { // ------------- display helper functions ----------------- void dp_setTextCursor(int x, int y) { - // x represents the pixel column - // y represents the text row - dp_col = x; - #if (HAS_DISPLAY) == 1 - dp_row = y; - obdSetCursor(&ssoled, dp_col, dp_row); - + oled.setCursor(x, y); #elif (HAS_DISPLAY) == 2 - switch (dp_font >> 1) { - case MY_FONT_STRETCHED: - case MY_FONT_LARGE: - dp_row = y * 26; - break; - case MY_FONT_SMALL: - case MY_FONT_NORMAL: - default: - dp_row = y * 16; - break; - } - tft.setCursor(dp_col, dp_row); + tft.setCursor(x, y); #endif } void dp_setFont(int font, int inv) { + #if (HAS_DISPLAY) == 1 - dp_font = (font << 1) | (inv & 0x01); + // handle invers printing + if (inv) + oled.setTextColor(MY_DISPLAY_BGCOLOR, MY_DISPLAY_FGCOLOR); + else + oled.setTextColor(MY_DISPLAY_FGCOLOR, MY_DISPLAY_BGCOLOR); + + // set desired font + oled.setFont(font); + #elif (HAS_DISPLAY) == 2 - // map font oled -> tft + // handle invers printing + if (inv) + tft.setTextColor(MY_DISPLAY_BGCOLOR, MY_DISPLAY_FGCOLOR); + else + tft.setTextColor(MY_DISPLAY_FGCOLOR, MY_DISPLAY_BGCOLOR); + + // map desired oled font to tft font switch (font) { case MY_FONT_STRETCHED: // 16x16 on OLED case MY_FONT_LARGE: // 16x32 on OLED @@ -495,18 +462,15 @@ void dp_setFont(int font, int inv) { tft.setTextFont(2); // 16px break; } - // to do: invers printing + #endif } -void dp_println(int lines) { - dp_col = 0; - dp_row += lines; +void dp_println(void) { #if (HAS_DISPLAY) == 1 - dp_setTextCursor(dp_col, dp_row); + oled.println(); #elif (HAS_DISPLAY) == 2 - for (int i = 1; i <= lines; i++) - tft.println(); + tft.println(); #endif }; @@ -533,8 +497,7 @@ void dp_printf(const char *format, ...) { } va_end(arg); #if (HAS_DISPLAY) == 1 - obdWriteString(&ssoled, 0, -1, dp_row, temp, dp_font >> 1, dp_font & 0x01, - false); + oled.write(temp); #elif (HAS_DISPLAY) == 2 tft.printf(temp); #endif @@ -545,26 +508,29 @@ void dp_printf(const char *format, ...) { void dp_dump(uint8_t *pBuffer) { #if (HAS_DISPLAY) == 1 - obdDumpBuffer(&ssoled, pBuffer); + if (pBuffer) + memcpy(oled.getBuffer(), pBuffer, PLOTBUFFERSIZE); + oled.display(); #elif (HAS_DISPLAY) == 2 - // probably oled buffer stucture is not suitable for tft -> to be checked - tft.drawBitmap(0, 0, pBuffer, MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT, - MY_DISPLAY_FGCOLOR); + if (pBuffer) + tft.drawBitmap(0, 0, pBuffer, MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT, + MY_DISPLAY_FGCOLOR); #endif } void dp_clear(void) { - dp_setTextCursor(0, 0); #if (HAS_DISPLAY) == 1 - obdFill(&ssoled, 0, 1); + oled.fillScreen(MY_DISPLAY_BGCOLOR); + oled.display(); #elif (HAS_DISPLAY) == 2 tft.fillScreen(MY_DISPLAY_BGCOLOR); #endif + dp_setTextCursor(0, 0); } void dp_contrast(uint8_t contrast) { #if (HAS_DISPLAY) == 1 - obdSetContrast(&ssoled, contrast); + oled.setContrast(contrast); #elif (HAS_DISPLAY) == 2 // to do: gamma correction for TFT #endif @@ -572,7 +538,10 @@ void dp_contrast(uint8_t contrast) { void dp_power(uint8_t screenon) { #if (HAS_DISPLAY) == 1 - obdPower(&ssoled, screenon); + //not yet in library, awaiting PR https://github.com/bitbank2/OneBitDisplay/pull/34 + //oled.setPower(screenon); + //as workaround be blank the sreen + dp_clear(); #elif (HAS_DISPLAY) == 2 // to come #endif @@ -580,7 +549,10 @@ void dp_power(uint8_t screenon) { void dp_shutdown(void) { #if (HAS_DISPLAY) == 1 - obdPower(&ssoled, false); + //not yet in library, awaiting PR https://github.com/bitbank2/OneBitDisplay/pull/34 + //oled.setPower(false); + //as workaround be blank the sreen + dp_clear(); delay(DISPLAYREFRESH_MS / 1000 * 1.1); #elif (HAS_DISPLAY) == 2 // to come @@ -589,10 +561,10 @@ void dp_shutdown(void) { // print static message on display void dp_message(const char *msg, int line, bool invers) { - dp_setTextCursor(0, line); - dp_setFont(MY_FONT_NORMAL, invers ? 1 : 0); + dp_setFont(MY_FONT_SMALL, invers ? 1 : 0); + dp_setTextCursor(0, line * 8); dp_printf("%-16s", msg); - dp_dump(displaybuf); + dp_dump(); } // dp_message // ------------- QR code plotter ----------------- @@ -625,8 +597,7 @@ void dp_printqr(uint16_t offset_x, uint16_t offset_y, const char *Message) { void dp_fillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t bRender) { #if (HAS_DISPLAY) == 1 - for (uint16_t xi = x; xi < x + width; xi++) - obdDrawLine(&ssoled, xi, y, xi, y + height - 1, 1, bRender); + oled.fillRect(x, y, width, height, MY_DISPLAY_FGCOLOR); #elif (HAS_DISPLAY) == 2 tft.fillRect(x, y, width, height, MY_DISPLAY_FGCOLOR); #endif diff --git a/src/ota.cpp b/src/ota.cpp index 792dd4f0..78abaed1 100644 --- a/src/ota.cpp +++ b/src/ota.cpp @@ -62,7 +62,7 @@ void start_ota_update() { dp_printf("Downloading .."); dp_println(); dp_printf("Rebooting .."); - dp_dump(displaybuf); + dp_dump(); #endif ESP_LOGI(TAG, "Starting Wifi OTA update"); @@ -331,14 +331,14 @@ void ota_display(const uint8_t row, const std::string status, const std::string msg) { #ifdef HAS_DISPLAY dp_setFont(MY_FONT_SMALL); - dp_setTextCursor(14, row); + dp_setTextCursor(14, row * 8); dp_printf(status.substr(0, 2).c_str()); if (!msg.empty()) { dp_printf(" "); dp_printf(msg.substr(0, 16).c_str()); dp_println(); } - dp_dump(displaybuf); + dp_dump(); #endif } From b13f897a03a3620faddd0fe19bce269cd6e38ae5 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 18:07:54 +0200 Subject: [PATCH 13/17] bump to v3.3.0 --- platformio_orig.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 0ada2b1a..c08a634f 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -46,7 +46,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 = 3.2.2 +release_version = 3.3.0 ; 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 @@ -61,7 +61,7 @@ display_library = ; set by build.py and taken from hal file lib_deps_lora = mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1 lib_deps_display = - bitbank2/OneBitDisplay @ ^1.11.0 + bitbank2/OneBitDisplay @ ^2.1.0 ricmoo/QRCode @ ^0.0.1 bodmer/TFT_eSPI @ ^2.3.84 lib_deps_ledmatrix = From ee644597c0f5a991db74749c6552be4d3597f965 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 17 Jul 2022 18:10:53 +0200 Subject: [PATCH 14/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5eaabb8c..3b3db4e6 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Some 3D printable cases can be found (and, if wanted so, ordered) on Thin for example.
Power consumption was metered at around 450 - 1000mW, depending on board and user settings in paxcounter.conf. -By default bluetooth sniffing not installed (#define *BLECOUNTER* 0 in paxcounter.conf). Installing and enabling bluetooth costs 30% more power + 30% flash storage for the software stack. If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results. +By default bluetooth sniffing not installed (#define *BLECOUNTER* 0 in paxcounter.conf). If you enable bluetooth be aware that this goes on expense of wifi sniffing results, because then wifi and bt stack must share the 2,4 GHz RF ressources of ESP32. If you need to sniff wifi and bt in parallel and need best possible results, use two boards - one for wifi only and one for bt only - and add counted results. # Preparing From 6b111bfd5c95342db11f746865b7a36883ef69c6 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Mon, 18 Jul 2022 12:22:08 +0200 Subject: [PATCH 15/17] display.cpp: oled.setPower added --- platformio_orig.ini | 3 ++- src/display.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index c08a634f..b618a5e7 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -61,7 +61,8 @@ display_library = ; set by build.py and taken from hal file lib_deps_lora = mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1 lib_deps_display = - bitbank2/OneBitDisplay @ ^2.1.0 + https://github.com/bitbank2/OneBitDisplay#8d4ab34 + ;bitbank2/OneBitDisplay @ ^2.1.0 ricmoo/QRCode @ ^0.0.1 bodmer/TFT_eSPI @ ^2.3.84 lib_deps_ledmatrix = diff --git a/src/display.cpp b/src/display.cpp index 22766ba2..7829cb93 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -538,10 +538,7 @@ void dp_contrast(uint8_t contrast) { void dp_power(uint8_t screenon) { #if (HAS_DISPLAY) == 1 - //not yet in library, awaiting PR https://github.com/bitbank2/OneBitDisplay/pull/34 - //oled.setPower(screenon); - //as workaround be blank the sreen - dp_clear(); + oled.setPower(screenon); #elif (HAS_DISPLAY) == 2 // to come #endif @@ -549,10 +546,7 @@ void dp_power(uint8_t screenon) { void dp_shutdown(void) { #if (HAS_DISPLAY) == 1 - //not yet in library, awaiting PR https://github.com/bitbank2/OneBitDisplay/pull/34 - //oled.setPower(false); - //as workaround be blank the sreen - dp_clear(); + oled.setPower(false); delay(DISPLAYREFRESH_MS / 1000 * 1.1); #elif (HAS_DISPLAY) == 2 // to come From 1975fbe0dc96a4c7f48f365f5cd3cda1dc182c24 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Jul 2022 15:34:23 +0200 Subject: [PATCH 16/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b3db4e6..46b1964b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Paxcounter is an [ESP32](https://www.espressif.com/en/products/socs/esp32) MCU b Intention of this project is to do this without intrusion in privacy: You don't need to track people owned devices, if you just want to count them. Therefore, Paxcounter does not persistenly store MAC adresses and does no kind of fingerprinting the scanned devices. -Data can either be be stored on a local SD-card, transferred to cloud using LoRaWAN network or MQTT over TCP/IP, or transmitted to a local host using serial (SPI) interface. +Data can either be be stored on a local SD-card, transferred to cloud using LoRaWAN network (e.g. TheThingsNetwork or Helium) or MQTT over TCP/IP, or transmitted to a local host using serial (SPI) interface. You can build this project battery powered using ESP32 deep sleep mode and reach long uptimes with a single 18650 Li-Ion cell. From c511a9432d41f97868f2dc1243b1a9371a52facc Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 24 Jul 2022 14:34:37 +0200 Subject: [PATCH 17/17] remove dp_println() --- include/display.h | 1 - src/display.cpp | 66 ++++++++++++++--------------------------------- src/ota.cpp | 24 +++++++---------- 3 files changed, 29 insertions(+), 62 deletions(-) diff --git a/include/display.h b/include/display.h index bb509406..003cc0c2 100644 --- a/include/display.h +++ b/include/display.h @@ -97,7 +97,6 @@ void dp_init(bool verbose = false); void dp_shutdown(void); void dp_message(const char *msg, int line, bool invers); void dp_drawPage(bool nextpage); -void dp_println(void); void dp_printf(const char *format, ...); void dp_setFont(int font, int inv = 0); void dp_dump(uint8_t *pBuffer = NULL); diff --git a/src/display.cpp b/src/display.cpp index 7829cb93..b7a284eb 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -95,17 +95,12 @@ void dp_init(bool verbose) { esp_chip_info(&chip_info); dp_setFont(MY_FONT_NORMAL); - dp_printf("** PAXCOUNTER **"); - dp_println(); - dp_printf("Software v%s", PROGVERSION); - dp_println(); - dp_printf("ESP32 %d cores", chip_info.cores); - dp_println(); - dp_printf("Chip Rev.%d", chip_info.revision); - dp_println(); - dp_printf("WiFi%s%s", (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", + dp_printf("** PAXCOUNTER **\r\n"); + dp_printf("Software v%s\r\n", PROGVERSION); + dp_printf("ESP32 %d cores\r\n", chip_info.cores); + dp_printf("Chip Rev.%d\r\n", chip_info.revision); + dp_printf("WiFi%s%s\r\n", (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); - dp_println(); dp_printf("%dMB %s Flash", spi_flash_get_chip_size() / (1024 * 1024), (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "int." : "ext."); @@ -130,8 +125,7 @@ void dp_init(bool verbose) { const int x_offset = QR_SCALEFACTOR * 29 + 14; dp_setFont(MY_FONT_NORMAL); dp_setTextCursor(x_offset, 0); - dp_printf("DEVEUI:"); - dp_println(); + dp_printf("DEVEUI:\r\n"); for (uint8_t i = 0; i <= 3; i++) { dp_setTextCursor(x_offset, i * 8 + 20); dp_printf("%4.4s", deveui + i * 4); @@ -248,7 +242,7 @@ void dp_drawPage(bool nextpage) { #else dp_printf("Sniffer disabled"); #endif - dp_println(); + dp_printf("\r\n"); // line 4: Battery + GPS status + Wifi channel // B:a.bcV Sats:ab ch:ab @@ -260,14 +254,12 @@ void dp_drawPage(bool nextpage) { #else dp_printf(" "); #endif - dp_printf("chan:%02u", channel); - dp_println(); + dp_printf("chan:%02u\r\n", channel); // line 5: RSSI limiter + free memory // RLIM:abcd Mem:abcdKB dp_printf(!cfg.rssilimit ? "RLIM:off " : "RLIM:%-4d", cfg.rssilimit); - dp_printf(" Mem:%4dKB", getFreeRAM() / 1024); - dp_println(); + dp_printf(" Mem:%4dKB\r\n", getFreeRAM() / 1024); // line 6: time + date // Wed Jan 12 21:49:08 * @@ -282,12 +274,11 @@ void dp_drawPage(bool nextpage) { // display inverse timeState if clock controller is enabled #if (defined HAS_DCF77) || (defined HAS_IF482) dp_setFont(MY_FONT_SMALL, 1); - dp_printf("%c", timeState); + dp_printf("%c\r\n", timeState); dp_setFont(MY_FONT_SMALL, 0); #else - dp_printf("%c", timeState); + dp_printf("%c\r\n", timeState); #endif - dp_println(); #endif // TIME_SYNC_INTERVAL // line 7: LMIC status @@ -318,15 +309,11 @@ void dp_drawPage(bool nextpage) { dp_setFont(MY_FONT_SMALL); dp_setTextCursor(); - dp_printf("Net:%06X Pwr:%-2d", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); - dp_println(); - dp_printf("Dev:%08X DR:%1d", LMIC.devaddr, LMIC.datarate); - dp_println(); - dp_printf("ChMsk:%04X Nonce:%04X", LMIC.channelMap, LMIC.devNonce); - dp_println(); - dp_printf("fUp:%-6d fDn:%-6d", LMIC.seqnoUp ? LMIC.seqnoUp - 1 : 0, + dp_printf("Net:%06X Pwr:%-2d\r\n", LMIC.netid & 0x001FFFFF, LMIC.radio_txpow); + dp_printf("Dev:%08X DR:%1d\r\n", LMIC.devaddr, LMIC.datarate); + dp_printf("ChMsk:%04X Nonce:%04X\r\n", LMIC.channelMap, LMIC.devNonce); + dp_printf("fUp:%-6d fDn:%-6d\r\n", LMIC.seqnoUp ? LMIC.seqnoUp - 1 : 0, LMIC.seqnoDn ? LMIC.seqnoDn - 1 : 0); - dp_println(); dp_printf("SNR:%-5d RSSI:%-5d", (LMIC.snr + 2) / 4, LMIC.rssi); dp_dump(); @@ -349,9 +336,8 @@ void dp_drawPage(bool nextpage) { // show latitude and longitude dp_setFont(MY_FONT_STRETCHED); dp_setTextCursor(); - dp_printf("%c%09.6f", gps.location.rawLat().negative ? 'S' : 'N', + dp_printf("%c%09.6f\r\n", gps.location.rawLat().negative ? 'S' : 'N', gps.location.lat()); - dp_println(); dp_printf("%c%09.6f", gps.location.rawLng().negative ? 'W' : 'E', gps.location.lng()); dp_dump(); @@ -366,13 +352,10 @@ void dp_drawPage(bool nextpage) { #if (HAS_BME) dp_setFont(MY_FONT_STRETCHED); dp_setTextCursor(0, 0); - dp_printf("TMP: %-6.1f", bme_status.temperature); - dp_println(); - dp_printf("HUM: %-6.1f", bme_status.humidity); - dp_println(); - dp_printf("PRE: %-6.1f", bme_status.pressure); + dp_printf("TMP: %-6.1f\r\n", bme_status.temperature); + dp_printf("HUM: %-6.1f\r\n", bme_status.humidity); + dp_printf("PRE: %-6.1f\r\n", bme_status.pressure); #ifdef HAS_BME680 - dp_println(); dp_printf("IAQ: %-6.0f", bme_status.iaq); #endif dp_dump(); @@ -393,8 +376,7 @@ void dp_drawPage(bool nextpage) { dp_printf("Timeofday:"); dp_setTextCursor(0, 26); dp_setFont(MY_FONT_LARGE); - dp_printf("%.8s", strftime_buf); - dp_println(); + dp_printf("%.8s\r\n", strftime_buf); dp_setFont(MY_FONT_SMALL); dp_printf("%21.1f", uptime() / 1000.0); dp_dump(); @@ -466,14 +448,6 @@ void dp_setFont(int font, int inv) { #endif } -void dp_println(void) { -#if (HAS_DISPLAY) == 1 - oled.println(); -#elif (HAS_DISPLAY) == 2 - tft.println(); -#endif -}; - void dp_printf(const char *format, ...) { char loc_buf[64]; char *temp = loc_buf; diff --git a/src/ota.cpp b/src/ota.cpp index 78abaed1..77726708 100644 --- a/src/ota.cpp +++ b/src/ota.cpp @@ -50,18 +50,13 @@ void start_ota_update() { #ifdef HAS_DISPLAY dp_setup(); - - dp_printf("SOFTWARE UPDATE"); - dp_println(); - dp_printf("WiFi connect .."); - dp_println(); - dp_printf("Has Update? .."); - dp_println(); - dp_printf("Fetching .."); - dp_println(); - dp_printf("Downloading .."); - dp_println(); - dp_printf("Rebooting .."); + dp_setFont(MY_FONT_NORMAL); + dp_printf("SOFTWARE UPDATE\r\n"); + dp_printf("WiFi connect ..\r\n"); + dp_printf("Has Update? ..\r\n"); + dp_printf("Fetching ..\r\n"); + dp_printf("Downloading ..\r\n"); + dp_printf("Rebooting ..\r\n"); dp_dump(); #endif @@ -330,13 +325,12 @@ retry: void ota_display(const uint8_t row, const std::string status, const std::string msg) { #ifdef HAS_DISPLAY - dp_setFont(MY_FONT_SMALL); - dp_setTextCursor(14, row * 8); + dp_setTextCursor(14 * 8, row * 8); dp_printf(status.substr(0, 2).c_str()); if (!msg.empty()) { dp_printf(" "); dp_printf(msg.substr(0, 16).c_str()); - dp_println(); + // dp_printf("\r\n"); } dp_dump(); #endif