From 0c36b07bec0f7dd344b0269066822e8bb0769f78 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 6 May 2023 14:22:35 +0200 Subject: [PATCH 1/6] Update lmic_config.h --- src/lmic_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lmic_config.h b/src/lmic_config.h index c544c81b..ce31292e 100644 --- a/src/lmic_config.h +++ b/src/lmic_config.h @@ -43,7 +43,7 @@ // enable more verbose output. Make sure that printf is actually // configured (e.g. on AVR it is not by default), otherwise using it can // cause crashing. -//#define LMIC_DEBUG_LEVEL 1 +#define LMIC_DEBUG_LEVEL 1 // Enable this to allow using printf() to print to the given serial port // (or any other Print object). This can be easy for debugging. The @@ -106,4 +106,4 @@ //#define USE_MBEDTLS_AES // Define this for devices with external power. -//#define LMIC_MCMD_DEVS_BATT_DEFAULT MCMD_DEVS_EXT_POWER \ No newline at end of file +//#define LMIC_MCMD_DEVS_BATT_DEFAULT MCMD_DEVS_EXT_POWER From e5bc7d637e50fb24ba7d0d17d2e902253a66fb6b Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 May 2023 13:19:52 +0200 Subject: [PATCH 2/6] display.cpp: shorten tm buffer to save RAM --- src/display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display.cpp b/src/display.cpp index d14369e1..2d661acc 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -142,7 +142,7 @@ void dp_init(bool verbose) { void dp_refresh(bool nextPage) { struct count_payload_t count; // libpax count storage static uint8_t DisplayPage = 0; - char timeState, strftime_buf[64]; + char timeState, strftime_buf[45]; time_t now; struct tm timeinfo = {0}; #ifndef HAS_BUTTON From a35bee53b118ee551586a64941dbd3fec0fda91a Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 May 2023 15:45:18 +0200 Subject: [PATCH 3/6] remove usage of PSRAM, to free IRAM, bump to 3.6.0 --- platformio_orig.ini | 20 +++++++++----------- platformio_orig_s3.ini | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 112a618f..40a23edb 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.5.0 +release_version = 3.6.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 @@ -54,7 +54,7 @@ extra_scripts = pre:src/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@6.0.1 +platform_espressif32 = espressif32@6.3.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file lib_deps_lora = @@ -91,19 +91,17 @@ lib_deps_all = ${common.lib_deps_gps} ${common.lib_deps_sensors} ${common.lib_deps_ledmatrix} -build_flags_basic = +build_flags_all = -include "src/paxcounter.conf" - '-DCORE_DEBUG_LEVEL=${common.debug_level}' - '-DLOG_LOCAL_LEVEL=${common.debug_level}' - '-DPROGVERSION="${common.release_version}"' + '-D CORE_DEBUG_LEVEL=${common.debug_level}' + '-D LOG_LOCAL_LEVEL=${common.debug_level}' + '-D PROGVERSION="${common.release_version}"' '-D LIBPAX_WIFI' '-D LIBPAX_BLE' '-D LIBPAX_ARDUINO' - '-DUSE_ESP_IDF_LOG' - '-DTAG=__FILE__' -build_flags_all = - ${common.build_flags_basic} - -mfix-esp32-psram-cache-issue + '-D USE_ESP_IDF_LOG' + '-D TAG=__FILE__' + '-U BOARD_HAS_PSRAM' [env] framework = arduino diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index d4cc59b5..3d27725c 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -10,7 +10,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.5.0 +release_version = 3.6.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 @@ -18,7 +18,7 @@ extra_scripts = pre:src/build.py otakeyfile = ota.conf lorakeyfile = loraconf.h lmicconfigfile = lmic_config.h -platform_espressif32 = espressif32@6.0.1 +platform_espressif32 = espressif32@6.3.0 monitor_speed = 115200 upload_speed = 115200 ; set by build.py and taken from hal file lib_deps_all = @@ -31,19 +31,17 @@ lib_deps_all = mathertel/OneButton @ ^2.0.3 256dpi/MQTT @ ^2.5.1 ricmoo/QRCode @ ^0.0.1 -build_flags_basic = +build_flags_all = -include "src/paxcounter.conf" - '-DCORE_DEBUG_LEVEL=${common.debug_level}' - '-DLOG_LOCAL_LEVEL=${common.debug_level}' - '-DPROGVERSION="${common.release_version}"' + '-D CORE_DEBUG_LEVEL=${common.debug_level}' + '-D LOG_LOCAL_LEVEL=${common.debug_level}' + '-D PROGVERSION="${common.release_version}"' '-D LIBPAX_WIFI' '-D LIBPAX_BLE' '-D LIBPAX_ARDUINO' - '-DUSE_ESP_IDF_LOG' - '-DTAG=__FILE__' -build_flags_all = - ${common.build_flags_basic} - -mfix-esp32-psram-cache-issue + '-D USE_ESP_IDF_LOG' + '-D TAG=__FILE__' + '-U BOARD_HAS_PSRAM' [env] framework = arduino From bed593ff0b57334c3d11c31bbccb1c6df2c271e7 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 May 2023 17:51:41 +0200 Subject: [PATCH 4/6] generic.h: shrink features due to IRAM shortage --- src/hal/generic.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/hal/generic.h b/src/hal/generic.h index cd339f48..9124269d 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -11,12 +11,12 @@ // generic.h is kitchensink with all available options #define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no LoRa -#define HAS_SPI 1 // comment out if device shall not send data via SPI +//#define HAS_SPI 1 // comment out if device shall not send data via SPI // pin definitions for SPI slave interface -#define SPI_MOSI GPIO_NUM_23 -#define SPI_MISO GPIO_NUM_19 -#define SPI_SCLK GPIO_NUM_18 -#define SPI_CS GPIO_NUM_5 +//#define SPI_MOSI GPIO_NUM_23 +//#define SPI_MISO GPIO_NUM_19 +//#define SPI_SCLK GPIO_NUM_18 +//#define SPI_CS GPIO_NUM_5 // enable only if you want to store a local paxcount table on the device #define HAS_SDCARD 1 // this board has an SD-card-reader/writer @@ -35,9 +35,9 @@ // for loading necessary libraries // BME680 sensor on I2C bus -#define HAS_BME 1 // Enable BME sensors in general -#define HAS_BME680 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL -#define BME680_ADDR BME68X_I2C_ADDR_LOW // connect SDIO of BME680 to GND +//#define HAS_BME 1 // Enable BME sensors in general +//#define HAS_BME680 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL +//#define BME680_ADDR BME68X_I2C_ADDR_LOW // connect SDIO of BME680 to GND // BME280 sensor on I2C bus //#define HAS_BME 1 // Enable BME sensors in general @@ -49,10 +49,10 @@ //#define BMP180_ADDR 0x77 // SDS011 dust sensor settings -#define HAS_SDS011 1 // use SDS011 +//#define HAS_SDS011 1 // use SDS011 // used pins on the ESP-side: -#define SDS_TX 19 // connect to RX on the SDS011 -#define SDS_RX 23 // connect to TX on the SDS011 +//#define SDS_TX 19 // connect to RX on the SDS011 +//#define SDS_RX 23 // connect to TX on the SDS011 // up to three user defined sensors (if connected) //#define HAS_SENSOR_1 1 // comment out if device has user defined sensor #1 @@ -64,29 +64,29 @@ //#define BOARD_HAS_PSRAM // use if board has external SPIRAM, note: this will reduce IRAM0 by 64KB for SPIRAM cache #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature -#define HAS_DISPLAY 1 +//#define HAS_DISPLAY 1 //#define MY_DISPLAY_FLIP 1 // use if display is rotated #define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 #define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board #define HAS_LED (21) // on board LED #define HAS_BUTTON (39) // on board button -#define RGB_LED_COUNT 1 // we have 1 LED -#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); +//#define RGB_LED_COUNT 1 // we have 1 LED +//#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); // GPS settings -#define HAS_GPS 1 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M RX, TX -#define GPS_INT GPIO_NUM_13 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO13 +//#define HAS_GPS 1 // use on board GPS +//#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M RX, TX +//#define GPS_INT GPIO_NUM_13 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO13 // Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (4) -#define MY_DISPLAY_SCL (15) -#define MY_DISPLAY_RST (16) +//#define MY_DISPLAY_SDA (4) +//#define MY_DISPLAY_SCL (15) +//#define MY_DISPLAY_RST (16) // Settings for on board DS3231 RTC chip -#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL -#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day +//#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL +//#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day // Settings for IF482 interface //#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters From df25a9de1ae33795c7d668a9d8b5bbda6ed5ea7c Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 May 2023 17:51:53 +0200 Subject: [PATCH 5/6] m5fire.h: shrink features due to IRAM shortage --- src/hal/m5fire.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hal/m5fire.h b/src/hal/m5fire.h index c4e25e1d..1c46e406 100644 --- a/src/hal/m5fire.h +++ b/src/hal/m5fire.h @@ -1,7 +1,6 @@ // clang-format off // upload_speed 921600 -// board m5stack-core-esp32 -// b0ard m5stack-fire -> does not compile due to IRAM0 shortage, because 64KB of 192KB used for caching external SPIRAM +// board m5stack-fire // note use of GPIO16/17 // https://www.bjoerns-techblog.de/2019/03/m5stack-fire-eine-uebersicht/ @@ -22,18 +21,18 @@ #define LORA_IO2 LMIC_UNUSED_PIN // enable only if you want to store a local paxcount table on the device -#define HAS_SDCARD 1 // this board has an SD-card-reader/writer -#define SDCARD_CS GPIO_NUM_4 -#define SDCARD_MOSI MOSI -#define SDCARD_MISO MISO -#define SDCARD_SCLK SCK +//#define HAS_SDCARD 1 // this board has an SD-card-reader/writer +//#define SDCARD_CS GPIO_NUM_4 +//#define SDCARD_MOSI MOSI +//#define SDCARD_MISO MISO +//#define SDCARD_SCLK SCK #define CFG_sx1276_radio 1 // select LoRa chip #define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature #define HAS_LED NOT_A_PIN // no on board LED (?) -#define RGB_LED_COUNT 10 // M5fire has a stripe of 10 RGB Pixels -#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); +//#define RGB_LED_COUNT 10 // M5fire has a stripe of 10 RGB Pixels +//#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); #define HAS_BUTTON (39) // on board button A // power management settings From 831d94c1208954f62df27e43c43ef3d23e5b27d8 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 May 2023 18:09:12 +0200 Subject: [PATCH 6/6] disable lmic debug output --- src/lmic_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lmic_config.h b/src/lmic_config.h index ce31292e..c586846a 100644 --- a/src/lmic_config.h +++ b/src/lmic_config.h @@ -43,7 +43,7 @@ // enable more verbose output. Make sure that printf is actually // configured (e.g. on AVR it is not by default), otherwise using it can // cause crashing. -#define LMIC_DEBUG_LEVEL 1 +//#define LMIC_DEBUG_LEVEL 1 // Enable this to allow using printf() to print to the given serial port // (or any other Print object). This can be easy for debugging. The