From be7719aa158ccfa9a17fd860b3ab93ba3d701869 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 7 Aug 2022 12:44:25 +0200 Subject: [PATCH 01/16] initial commit --- include/globals.h | 2 +- include/i2c.h | 17 +++++++------ include/led.h | 4 +-- src/hal/ttgotdisplays3.h | 55 ++++++++++++++++++++++++++++++++++++++++ src/reset.cpp | 12 ++++----- 5 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 src/hal/ttgotdisplays3.h diff --git a/include/globals.h b/include/globals.h index 9150be80..c4ed7ed8 100644 --- a/include/globals.h +++ b/include/globals.h @@ -12,7 +12,7 @@ #include #include #include -#include +//#include #define _bit(b) (1U << (b)) #define _bitl(b) (1UL << (b)) diff --git a/include/i2c.h b/include/i2c.h index ce64ff70..ec6709f9 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -3,6 +3,15 @@ #include #include +#include + +#ifndef MY_DISPLAY_SDA +#define MY_DISPLAY_SDA SDA +#endif + +#ifndef MY_DISPLAY_SCL +#define MY_DISPLAY_SCL SCL +#endif #define SSD1306_PRIMARY_ADDRESS (0x3D) #define SSD1306_SECONDARY_ADDRESS (0x3C) @@ -13,14 +22,6 @@ #define MCP_24AA02E64_PRIMARY_ADDRESS (0x50) #define QUECTEL_GPS_PRIMARY_ADDRESS (0x10) -#ifndef MY_DISPLAY_SDA -#define MY_DISPLAY_SDA SDA -#endif - -#ifndef MY_DISPLAY_SCL -#define MY_DISPLAY_SCL SCL -#endif - extern SemaphoreHandle_t I2Caccess; void i2c_init(void); diff --git a/include/led.h b/include/led.h index 6ee08289..d7e349ad 100644 --- a/include/led.h +++ b/include/led.h @@ -1,8 +1,8 @@ #ifndef _LED_H #define _LED_H -#include -#include "lorawan.h" +//#include +//#include "lorawan.h" #ifndef RGB_LED_COUNT #define RGB_LED_COUNT 1 diff --git a/src/hal/ttgotdisplays3.h b/src/hal/ttgotdisplays3.h new file mode 100644 index 00000000..3e6ee8a1 --- /dev/null +++ b/src/hal/ttgotdisplays3.h @@ -0,0 +1,55 @@ +// clang-format off +// upload_speed 1500000 +// board ESP32-S3-DevKitC-1 + +#ifndef _TTGOTDISPLAY_H +#define _TTGOTDISPLAY_H + +#include + +#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 +#define MY_DISPLAY_FLIP 1 // use if display is rotated + +#define HAS_LED NOT_A_PIN // no on board LED (?) +#define HAS_BUTTON (35) // on board button A + +// power management settings +//#define BAT_MEASURE_ADC ADC1_GPIO34_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_6 +//#define BAT_VOLTAGE_DIVIDER 2.605f // voltage divider + +// Display Settings +#define MY_DISPLAY_WIDTH 135 +#define MY_DISPLAY_HEIGHT 240 +#define MY_DISPLAY_INVERT 1 + +// setting for TTGO T-display +#define USER_SETUP_LOADED 1 +#define ST7789_DRIVER 1 + +#define CGRAM_OFFSET + +#define TFT_CS GPIO_NUM_6 // Chip select control +#define TFT_DC GPIO_NUM_7 // Data Command control +#define TFT_RST GPIO_NUM_5 // Reset +#define TFT_BL GPIO_NUM_38 // LED back-light + +#define TOUCH_CS NOT_A_PIN + +#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts +#define SMOOTH_FONT + +#define SPI_FREQUENCY 40000000 +#define SPI_READ_FREQUENCY 6000000 + +#endif diff --git a/src/reset.cpp b/src/reset.cpp index f62cb54b..53a270cc 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -61,7 +61,7 @@ void do_after_reset(void) { reset_rtc_vars(); break; - case SW_CPU_RESET: // 0x0c Software reset CPU + case RTC_SW_CPU_RESET: // 0x0c Software reset CPU // keep previous set runmode (update / normal / maintenance) RTC_restarts++; break; @@ -83,16 +83,16 @@ void do_after_reset(void) { RTC_runmode = RUNMODE_WAKEUP; break; - case SW_RESET: // 0x03 Software reset digital core - case OWDT_RESET: // 0x04 Legacy watch dog reset digital core - case SDIO_RESET: // 0x06 Reset by SLC module, reset digital core + //case SW_RESET: // 0x03 Software reset digital core + //case OWDT_RESET: // 0x04 Legacy watch dog reset digital core + //case SDIO_RESET: // 0x06 Reset by SLC module, reset digital core case TG0WDT_SYS_RESET: // 0x07 Timer Group0 Watch dog reset digital core case TG1WDT_SYS_RESET: // 0x08 Timer Group1 Watch dog reset digital core case RTCWDT_SYS_RESET: // 0x09 RTC Watch dog Reset digital core case INTRUSION_RESET: // 0x0a Instrusion tested to reset CPU - case TGWDT_CPU_RESET: // 0x0b Time Group reset CPU + //case TGWDT_CPU_RESET: // 0x0b Time Group reset CPU case RTCWDT_CPU_RESET: // 0x0d RTC Watch dog Reset CPU - case EXT_CPU_RESET: // 0x0e for APP CPU, reseted by PRO CPU + //case EXT_CPU_RESET: // 0x0e for APP CPU, reseted by PRO CPU case RTCWDT_RTC_RESET: // 0x10 RTC Watch dog reset digital core and rtc mode default: RTC_runmode = RUNMODE_POWERCYCLE; From d56ec8a39ebb9b166dae982fb6283e986c90ddb6 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 9 Aug 2022 18:31:20 +0200 Subject: [PATCH 02/16] initial commit --- include/display.h | 4 ++ platformio_orig.ini | 133 -------------------------------------- src/hal/ebox.h | 29 --------- src/hal/eboxtube.h | 32 --------- src/hal/ecopower.h | 56 ---------------- src/hal/fipy.h | 33 ---------- src/hal/generic.h | 108 ------------------------------- src/hal/heltec.h | 36 ----------- src/hal/heltecv2.h | 44 ------------- src/hal/heltecv21.h | 43 ------------ src/hal/lolin32lite.h | 21 ------ src/hal/lolin32litelora.h | 46 ------------- src/hal/lolin32lora.h | 47 -------------- src/hal/lopy.h | 32 --------- src/hal/lopy4.h | 42 ------------ src/hal/m5core.h | 81 ----------------------- src/hal/m5fire.h | 87 ------------------------- src/hal/octopus32.h | 49 -------------- src/hal/olimexpoeiso.h | 30 --------- src/hal/tinypico.h | 24 ------- src/hal/tinypicomatrix.h | 46 ------------- src/hal/ttgobeam.h | 44 ------------- src/hal/ttgobeam10.h | 85 ------------------------ src/hal/ttgofox.h | 48 -------------- src/hal/ttgotdisplay.h | 55 ---------------- src/hal/ttgotdisplays3.h | 2 +- src/hal/ttgotwristband.h | 58 ----------------- src/hal/ttgov1.h | 42 ------------ src/hal/ttgov2.h | 41 ------------ src/hal/ttgov21new.h | 44 ------------- src/hal/ttgov21old.h | 51 --------------- src/hal/wemos32matrix.h | 47 -------------- src/hal/wemos32oled.h | 20 ------ 33 files changed, 5 insertions(+), 1555 deletions(-) delete mode 100644 platformio_orig.ini delete mode 100644 src/hal/ebox.h delete mode 100644 src/hal/eboxtube.h delete mode 100644 src/hal/ecopower.h delete mode 100644 src/hal/fipy.h delete mode 100644 src/hal/generic.h delete mode 100644 src/hal/heltec.h delete mode 100644 src/hal/heltecv2.h delete mode 100644 src/hal/heltecv21.h delete mode 100644 src/hal/lolin32lite.h delete mode 100644 src/hal/lolin32litelora.h delete mode 100644 src/hal/lolin32lora.h delete mode 100644 src/hal/lopy.h delete mode 100644 src/hal/lopy4.h delete mode 100644 src/hal/m5core.h delete mode 100644 src/hal/m5fire.h delete mode 100644 src/hal/octopus32.h delete mode 100644 src/hal/olimexpoeiso.h delete mode 100644 src/hal/tinypico.h delete mode 100644 src/hal/tinypicomatrix.h delete mode 100644 src/hal/ttgobeam.h delete mode 100644 src/hal/ttgobeam10.h delete mode 100644 src/hal/ttgofox.h delete mode 100644 src/hal/ttgotdisplay.h delete mode 100644 src/hal/ttgotwristband.h delete mode 100644 src/hal/ttgov1.h delete mode 100644 src/hal/ttgov2.h delete mode 100644 src/hal/ttgov21new.h delete mode 100644 src/hal/ttgov21old.h delete mode 100644 src/hal/wemos32matrix.h delete mode 100644 src/hal/wemos32oled.h diff --git a/include/display.h b/include/display.h index b30ec372..3cbeb75a 100644 --- a/include/display.h +++ b/include/display.h @@ -89,6 +89,10 @@ #define MY_DISPLAY_HEIGHT 64 // Height in pixels of OLED-display, must be 64X #endif +#ifndef MY_DISPLAY_FIRSTLINE +#define MY_DISPLAY_FIRSTLINE 0 +#endif + // settings for qr code generator #define QR_VERSION 3 // 29 x 29px diff --git a/platformio_orig.ini b/platformio_orig.ini deleted file mode 100644 index b618a5e7..00000000 --- a/platformio_orig.ini +++ /dev/null @@ -1,133 +0,0 @@ -; ---> SELECT ONE TARGET BOARD FROM FOLLOWING ROWS <--- -; -; Note: For "LILYGO TTGO ESP32-Paxcounter LoRa32 V2.1 1.6.1" select board ttgov21new.h -; -; -[board] -;halfile = generic.h -;halfile = ebox.h -;halfile = eboxtube.h -;halfile = ecopower.h -;halfile = heltec.h -;halfile = heltecv2.h -;halfile = heltecv21.h -;halfile = ttgov1.h -;halfile = ttgov2.h -;halfile = ttgov21old.h -halfile = ttgov21new.h -;halfile = ttgofox.h -;halfile = ttgobeam.h -;halfile = ttgobeam10.h -;halfile = ttgotdisplay.h -;halfile = ttgotwristband.h -;halfile = fipy.h -;halfile = lopy.h -;halfile = lopy4.h -;halfile = lolin32litelora.h -;halfile = lolin32lora.h -;halfile = lolin32lite.h -;halfile = wemos32oled.h -;halfile = wemos32matrix.h -;halfile = octopus32.h -;halfile = tinypico.h -;halfile = tinypicomatrix.h -;halfile = m5core.h -;halfile = m5fire.h -;halfile = olimexpoeiso.h - -[platformio] -; upload firmware to board with usb cable -default_envs = usb -; upload firmware to a paxexpress repository -;default_envs = ota -; use upstream version of arduino-espressif32 framework -;default_envs = dev -description = Paxcounter is a device for metering passenger flows in realtime. It counts how many mobile devices are around. - -[common] -; for release_version use max. 10 chars total, use any decimal format like "a.b.c" -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 -extra_scripts = pre:build.py -otakeyfile = ota.conf -lorakeyfile = loraconf.h -lmicconfigfile = lmic_config.h -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 -lib_deps_lora = - mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1 -lib_deps_display = - 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 = - seeed-studio/Ultrathin_LED_Matrix @ ^1.0.0 -lib_deps_rgbled = - https://github.com/RoboticsBrno/SmartLeds.git -lib_deps_gps = - mikalhart/TinyGPSPlus @ ^1.0.2 -lib_deps_sensors = - adafruit/Adafruit Unified Sensor @ ^1.1.4 - adafruit/Adafruit BME280 Library @ ^2.2.1 - adafruit/Adafruit BMP085 Library @ ^1.2.0 - boschsensortec/BSEC Software Library @ 1.6.1480 - https://github.com/cyberman54/sds-dust-sensors-arduino-library.git -lib_deps_basic = - https://github.com/dbSuS/libpax.git - https://github.com/SukkoPera/Arduino-Rokkit-Hash.git - bblanchon/ArduinoJson @ ^6 - makuna/RTC @ ^2.3.5 - spacehuhn/SimpleButton - lewisxhe/AXP202X_Library @ ^1.1.3 - 256dpi/MQTT @ ^2.4.8 -lib_deps_all = - ${common.lib_deps_basic} - ${common.lib_deps_lora} - ${common.lib_deps_display} - ${common.lib_deps_rgbled} - ${common.lib_deps_gps} - ${common.lib_deps_sensors} - ${common.lib_deps_ledmatrix} -build_flags_basic = - -include "src/hal/${board.halfile}" - -include "src/paxcounter.conf" - '-DCORE_DEBUG_LEVEL=${common.debug_level}' - '-DLOG_LOCAL_LEVEL=${common.debug_level}' - '-DPROGVERSION="${common.release_version}"' - '-D LIBPAX_WIFI' - '-D LIBPAX_BLE' - '-D LIBPAX_ARDUINO' -build_flags_all = - ${common.build_flags_basic} - -mfix-esp32-psram-cache-issue - -[env] -framework = arduino -board = esp32dev -board_build.partitions = min_spiffs.csv -build_type = release -upload_speed = ${common.upload_speed} -;upload_port = COM12 -platform = ${common.platform_espressif32} -lib_deps = ${common.lib_deps_all} -build_flags = ${common.build_flags_all} -upload_protocol = ${common.upload_protocol} -extra_scripts = ${common.extra_scripts} -monitor_speed = ${common.monitor_speed} -monitor_filters = time, esp32_exception_decoder, default - -[env:ota] -upload_protocol = custom - -[env:usb] -upload_protocol = esptool - -[env:dev] -upload_protocol = esptool -platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream -platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git diff --git a/src/hal/ebox.h b/src/hal/ebox.h deleted file mode 100644 index 6da29292..00000000 --- a/src/hal/ebox.h +++ /dev/null @@ -1,29 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _EBOX_H -#define _EBOX_H - -#include - -// Hardware related definitions for ebox ESP32-bit with external connected RFM95 LoRa - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_LED (23) // blue LED on board -#define HAS_BUTTON (0) // button "PROG" on board -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST (14) -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 LMIC_UNUSED_PIN - -#endif \ No newline at end of file diff --git a/src/hal/eboxtube.h b/src/hal/eboxtube.h deleted file mode 100644 index e95b6940..00000000 --- a/src/hal/eboxtube.h +++ /dev/null @@ -1,32 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - - -#ifndef _EBOXTUBE_H -#define _EBOXTUBE_H - -#include - -// Hardware related definitions for ebox ESP32-bit with external connected RFM95 LoRa - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_LED (22) // Green LED on board -#define RGB_LED_COUNT 1 // we have 1 LED -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, RGB_LED_COUNT, GPIO_NUM_2) // WS2812B RGB LED on board -#define HAS_BUTTON (0) // button "FLASH" on board -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST (14) -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 (32) - -#endif \ No newline at end of file diff --git a/src/hal/ecopower.h b/src/hal/ecopower.h deleted file mode 100644 index 276b3c54..00000000 --- a/src/hal/ecopower.h +++ /dev/null @@ -1,56 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _GENERIC_H -#define _GENERIC_H - -#include - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no LoRa -#define CFG_sx1276_radio 1 // select LoRa chip - -//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#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 ((82.0+220.0)/82.0) // 82k + 220k 1% -//#define BAT_MEASURE_EN EXT_POWER_SW // Turn power on for measurement - -#define EXT_POWER_SW 15 // Switch VDD on pin JP10, needed for RTC DS3231 -#define EXT_POWER_ON 0 - -#define HAS_LED (2) // on board green LED -#define HAS_TWO_LED (12) // on board red LED -//#define HAS_BUTTON (0) // on board button -> don't use, is same as RTC_INT! - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA SDA -#define MY_DISPLAY_SCL SCL -#define MY_DISPLAY_RST NOT_A_PIN - -// Settings for on board DS3231 RTC chip -// note: to use RTC_INT, capacitor 100nF next to red LED must be removed to sharpen interrupt signal slope -// and setting EXT_POWER_ON is needed (this is done in main.cpp) -#define HAS_RTC MY_DISPLAY_SDA, MY_DISPLAY_SCL // SDA, SCL -#define RTC_INT GPIO_NUM_0 // - -// Settings for IF482 interface -//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_3, GPIO_NUM_1 // RX, TX - -// Settings for DCF77 interface -//#define HAS_DCF77 GPIO_NUM_14 // JP8 #13 -//#define DCF77_ACTIVE_LOW 1 - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK SCK -#define LORA_CS SS -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST (17) -#define LORA_IRQ (16) -#define LORA_IO1 (14) // JP8 #13 to be external wired -#define LORA_IO2 LMIC_UNUSED_PIN - -#endif \ No newline at end of file diff --git a/src/hal/fipy.h b/src/hal/fipy.h deleted file mode 100644 index f904d716..00000000 --- a/src/hal/fipy.h +++ /dev/null @@ -1,33 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _FIPY_H -#define _FIPY_H - -#include - -// Hardware related definitions for Pycom FiPy Board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa - -#define CFG_sx1272_radio 1 -#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_0) // WS2812B RGB LED on GPIO0 -#define BOARD_HAS_PSRAM // use extra 4MB extern RAM - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST LMIC_UNUSED_PIN -#define LORA_IRQ (23) // LoRa IRQ -#define LORA_IO1 (23) // Pin tied via diode to DIO0 -#define LORA_IO2 LMIC_UNUSED_PIN - -// select WIFI antenna (internal = onboard / external = u.fl socket) -#define HAS_ANTENNA_SWITCH GPIO_NUM_21 // pin for switching wifi antenna -#define WIFI_ANTENNA 0 // 0 = internal, 1 = external - -#endif diff --git a/src/hal/generic.h b/src/hal/generic.h deleted file mode 100644 index 26d465e3..00000000 --- a/src/hal/generic.h +++ /dev/null @@ -1,108 +0,0 @@ -// clang-format off -// upload_speed 115200 -// board esp32dev -// display_library lib_deps_oled_display - -#ifndef _GENERIC_H -#define _GENERIC_H - -#include - -// Hardware related definitions for generic ESP32 boards -// 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 -// 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 - -// 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 -// Pins for SD-card -#define SDCARD_CS (13) -#define SDCARD_MOSI (15) -#define SDCARD_MISO (2) -#define SDCARD_SCLK (14) - -// enable only if device has these sensors, otherwise comment these lines -// tutorial to connect BME sensor see here: -// https://sbamueller.wordpress.com/2019/02/26/paxcounter-mit-umweltsensor/ -// -// in platformio.ini append -// lib_deps = <...> ${common.lib_deps_sensors} -// 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 BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND - -// BME280 sensor on I2C bus -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME280 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL -//#define BME280_ADDR 0x76 // change to 0x77 depending on your wiring - -// BMP180 sensor on I2C bus -//#define HAS_BMP180 -//#define BMP180_ADDR 0x77 - -// SDS011 dust sensor settings -#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 - -// up to three user defined sensors (if connected) -//#define HAS_SENSOR_1 1 // comment out if device has user defined sensor #1 -//#define HAS_SENSOR_2 1 // comment out if device has user defined sensor #2 -//#define HAS_SENSOR_3 1 // comment out if device has user defined sensor #3 - -#define CFG_sx1276_radio 1 // select LoRa chip -//#define CFG_sx1272_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 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 HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_0) // WS2812B RGB LED on GPIO0 - -// 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 - -// Pins for I2C interface of OLED Display -#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 - -// Settings for IF482 interface -//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters - -// Settings for DCF77 interface -//#define HAS_DCF77 GPIO_NUM_1 -//#define DCF77_ACTIVE_LOW 1 - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST (14) -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 LMIC_UNUSED_PIN - -#endif diff --git a/src/hal/heltec.h b/src/hal/heltec.h deleted file mode 100644 index 3546089e..00000000 --- a/src/hal/heltec.h +++ /dev/null @@ -1,36 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board heltec_wifi_lora_32 - -#ifndef _HELTEC_H -#define _HELTEC_H - -#include - -// Hardware related definitions for Heltec V1 LoRa-32 Board -// see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v1 - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) -#define HAS_BUTTON KEY_BUILTIN // button "PROG" on board - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA SDA_OLED -#define MY_DISPLAY_SCL SCL_OLED -#define MY_DISPLAY_RST RST_OLED - -// Pins for LORA chip SPI interface come from board file, we need some -// additional definitions for LMIC -#define LORA_IRQ DIO0 -#define LORA_IO1 DIO1 -#define LORA_IO2 DIO2 -#define LORA_SCK SCK -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST RST_LoRa -#define LORA_CS SS - -#endif \ No newline at end of file diff --git a/src/hal/heltecv2.h b/src/hal/heltecv2.h deleted file mode 100644 index b047bdd8..00000000 --- a/src/hal/heltecv2.h +++ /dev/null @@ -1,44 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board heltec_wifi_lora_32_V2 - -#ifndef _HELTECV2_H -#define _HELTECV2_H - -#include - -// Hardware related definitions for Heltec V2 LoRa-32 Board -// see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v2 - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) -#define HAS_BUTTON KEY_BUILTIN // button "PROG" on board - -#define BAT_MEASURE_ADC ADC2_GPIO13_CHANNEL // battery probe GPIO pin -#define BAT_MEASURE_ADC_UNIT 2 // ADC 2 -#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 220k/100k on board - -// switches battery power and Vext, switch logic 0 = on / 1 = off -#define EXT_POWER_SW Vext -#define EXT_POWER_ON 0 - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA SDA_OLED -#define MY_DISPLAY_SCL SCL_OLED -#define MY_DISPLAY_RST RST_OLED - -// Pins for LORA chip SPI interface come from board file, we need some -// additional definitions for LMIC -#define LORA_IRQ DIO0 -#define LORA_IO1 DIO1 -#define LORA_IO2 DIO2 -#define LORA_SCK SCK -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST RST_LoRa -#define LORA_CS SS - -#endif diff --git a/src/hal/heltecv21.h b/src/hal/heltecv21.h deleted file mode 100644 index 9372325d..00000000 --- a/src/hal/heltecv21.h +++ /dev/null @@ -1,43 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board heltec_wifi_lora_32_V2 - -#ifndef _HELTECV21_H -#define _HELTECV21_H - -#include - -// Hardware related definitions for Heltec V2.1 LoRa-32 Board -// see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v2-1 - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_DISPLAY 1 // OLED-Display on board -#define HAS_LED LED_BUILTIN // white LED on board (set to NOT_A_PIN to disable) -#define HAS_BUTTON KEY_BUILTIN // button "PROG" on board - -#define BAT_MEASURE_ADC ADC1_GPIO37_CHANNEL // battery probe GPIO pin -#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 220k/100k on board - -// switches battery power and Vext, switch logic 0 = on / 1 = off -#define EXT_POWER_SW Vext -#define EXT_POWER_ON 0 - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA SDA_OLED -#define MY_DISPLAY_SCL SCL_OLED -#define MY_DISPLAY_RST RST_OLED - -// Pins for LORA chip SPI interface come from board file, we need some -// additional definitions for LMIC -#define LORA_IRQ DIO0 -#define LORA_IO1 DIO1 -#define LORA_IO2 DIO2 -#define LORA_SCK SCK -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST RST_LoRa -#define LORA_CS SS - -#endif diff --git a/src/hal/lolin32lite.h b/src/hal/lolin32lite.h deleted file mode 100644 index 3f9f9fe0..00000000 --- a/src/hal/lolin32lite.h +++ /dev/null @@ -1,21 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lolin32 - -#ifndef _LOLINLITE_H -#define _LOLINLITE_H - -#include - -// Hardware related definitions for lolin32lite (without LoRa shield) - -#define HAS_LED LED_BUILTIN // on board LED on GPIO5 -#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW (set to NOT_A_PIN to disable) - -#define MY_SDA SDA -#define MY_SCL SCL - -// disable brownout detection (avoid unexpected reset on some boards) -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#endif \ No newline at end of file diff --git a/src/hal/lolin32litelora.h b/src/hal/lolin32litelora.h deleted file mode 100644 index d3ae2133..00000000 --- a/src/hal/lolin32litelora.h +++ /dev/null @@ -1,46 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lolin32 - -#ifndef _LOLINLITELORA_H -#define _LOLINLITELORA_H - -#include - -// Hardware related definitions for lolin32 lite with loraNode32 shield -// See https://github.com/hallard/LoLin32-Lite-Lora - -// disable brownout detection (avoid unexpected reset on some boards) -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#define HAS_DISPLAY 1 // OLED-Display on board -//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED 22 // ESP32 GPIO12 (pin22) On Board LED (set to NOT_A_PIN to disable) -#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED -#define HAS_BUTTON 15 // ESP32 GPIO15 (pin15) Button is on the LoraNode32 shield -#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // RFM95 module - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK SCK -#define LORA_CS SS -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST (25) -#define LORA_IRQ (27) -#define LORA_IO1 (26) -#define LORA_IO2 (4) - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (12) -#define MY_DISPLAY_SCL (14) -#define MY_DISPLAY_RST NOT_A_PIN - -// I2C config for Microchip 24AA02E64 DEVEUI unique address -#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64 -#define MCP_24AA02E64_MAC_ADDRESS 0xF8 // Memory adress of unique deveui 64 bits - -#endif diff --git a/src/hal/lolin32lora.h b/src/hal/lolin32lora.h deleted file mode 100644 index 15cdb331..00000000 --- a/src/hal/lolin32lora.h +++ /dev/null @@ -1,47 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lolin32 - -#ifndef _LOLINLORA_H -#define _LOLINLORA_H - -#include - -// Hardware related definitions for lolin32 with loraNode32 shield -// See https://github.com/hallard/LoLin32-Lora - -// disable brownout detection (avoid unexpected reset on some boards) -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#define HAS_DISPLAY 1 // OLED-Display on board -//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED NOT_A_PIN // Led os on same pin as Lora SS pin, to avoid problems, we don't use it -#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW - // Anyway shield is on over the LoLin32 board, so we won't be able to see this LED -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED -#define HAS_BUTTON 15 // ESP32 GPIO15 (pin15) Button is on the LoraNode32 shield -#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // RFM95 module - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK SCK -#define LORA_CS SS -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST (25) -#define LORA_IRQ (27) -#define LORA_IO1 (26) -#define LORA_IO2 (4) - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA SDA -#define MY_DISPLAY_SCL SCL -#define MY_DISPLAY_RST NOT_A_PIN - -// I2C config for Microchip 24AA02E64 DEVEUI unique address -#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64 -#define MCP_24AA02E64_MAC_ADDRESS 0xF8 // Memory adress of unique deveui 64 bits - -#endif diff --git a/src/hal/lopy.h b/src/hal/lopy.h deleted file mode 100644 index e196ee1a..00000000 --- a/src/hal/lopy.h +++ /dev/null @@ -1,32 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lopy - -#ifndef _LOPY_H -#define _LOPY_H - -#include - -// Hardware related definitions for Pycom LoPy Board (NOT LoPy4) - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1272_radio 1 -#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_0) // WS2812B RGB LED on GPIO0 (P2) - -// Note: Pins for LORA chip SPI interface come from board file pins_arduino.h - -// select WIFI antenna (internal = onboard / external = u.fl socket) -#define HAS_ANTENNA_SWITCH (16) // pin for switching wifi antenna -#define WIFI_ANTENNA 0 // 0 = internal, 1 = external - -// uncomment this only if your LoPy runs on a EXPANSION BOARD -//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED -//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED -//#define HAS_BUTTON (13) // user button on expansion board -//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown -//#define BAT_MEASURE_ADC ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 -//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0 -//#define BAT_VOLTAGE_DIVIDER 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0 - -#endif diff --git a/src/hal/lopy4.h b/src/hal/lopy4.h deleted file mode 100644 index 0c5999f0..00000000 --- a/src/hal/lopy4.h +++ /dev/null @@ -1,42 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lopy4 - -#ifndef _LOPY4_H -#define _LOPY4_H - -#include - -// Hardware related definitions for Pycom LoPy4 Board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa - -//#defin HAS_SPI 1 // comment out if device shall not send data via SPI -// pin definitions for local wired SPI slave interface -//#define SPI_MOSI GPIO_NUM_22 -//#define SPI_MISO GPIO_NUM_33 -//#define SPI_SCLK GPIO_NUM_26 -//#define SPI_CS GPIO_NUM_36 - -#define CFG_sx1276_radio 1 -#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED -#define RGB_LED_COUNT 1 // we have 1 LEDs -#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, RGB_LED_COUNT, GPIO_NUM_0) // WS2812B RGB LED on GPIO0 (P2) -#define BOARD_HAS_PSRAM // use extra 4MB extern RAM - -// Note: Pins for LORA chip SPI interface come from board file pins_arduino.h - -// select WIFI antenna (internal = onboard / external = u.fl socket) -#define HAS_ANTENNA_SWITCH (21) // pin for switching wifi antenna (P12) -#define WIFI_ANTENNA 0 // 0 = internal, 1 = external - -// uncomment defines in this section ONLY if your LoPy lives on a EXPANSION BOARD -//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED -//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED -//#define HAS_BUTTON (13) // user button on expansion board -//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown -//#define BAT_MEASURE_ADC ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 -//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0 -//#define BAT_VOLTAGE_DIVIDER 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0 - -#endif \ No newline at end of file diff --git a/src/hal/m5core.h b/src/hal/m5core.h deleted file mode 100644 index 7a65e40a..00000000 --- a/src/hal/m5core.h +++ /dev/null @@ -1,81 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board m5stack-core-esp32 - -#ifndef _M5CORE_H -#define _M5CORE_H - -#include - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no M5 RA01 LoRa module -#define LORA_SCK SCK -#define LORA_CS SS -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST GPIO_NUM_26 -#define LORA_IRQ GPIO_NUM_36 -#define LORA_IO1 GPIO_NUM_34 // must be wired by you on PCB! -#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 -// Pins for SD-card -#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_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet -//#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define HAS_LED NOT_A_PIN // no on board LED (?) -#define HAS_BUTTON (39) // on board button A - -// power management settings -#define HAS_IP5306 1 // has IP5306 chip -#define PMU_CHG_CURRENT 2 // battery charge current -// possible values: 0:200mA, 1:400mA, *2:500mA, 3:600mA -#define PMU_CHG_CUTOFF 0 // battery charge cutoff -// possible values: *0:4.2V, 1:4.3V, 2:4.35V, 3:4.4V - -// GPS settings -#define HAS_GPS 1 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, RXD2, TXD2 // UBlox NEO 6M RX, TX -#define GPS_INT GPIO_NUM_35 // 30ns accurary timepulse, to be external wired on pcb: shorten R12! - -// Display Settings -#define MY_DISPLAY_WIDTH 320 -#define MY_DISPLAY_HEIGHT 240 -#define MY_DISPLAY_INVERT 1 - -// setting for M5 display -#define USER_SETUP_LOADED 1 -#define ILI9341_DRIVER 1 -#define M5STACK // needed for TFT driver - -#define TFT_MISO MISO // SPI -#define TFT_MOSI MOSI // SPI -#define TFT_SCLK SCK // SPI -#define TFT_CS GPIO_NUM_14 // Chip select control -#define TFT_DC GPIO_NUM_27 // Data Command control -#define TFT_RST GPIO_NUM_33 // Reset -#define TFT_BL GPIO_NUM_32 // LED back-light - -#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red - -//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH -#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters -#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters -//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm -//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. -//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. -//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT -//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts -#define SMOOTH_FONT - -#define SPI_FREQUENCY 40000000 - -#endif diff --git a/src/hal/m5fire.h b/src/hal/m5fire.h deleted file mode 100644 index b83de54a..00000000 --- a/src/hal/m5fire.h +++ /dev/null @@ -1,87 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board m5stack-fire - -// note use of GPIO16/17 -// https://www.bjoerns-techblog.de/2019/03/m5stack-fire-eine-uebersicht/ - -#ifndef _M5FIRE_H -#define _M5FIRE_H - -#include - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no M5 RA01 LoRa module -#define LORA_SCK SCK -#define LORA_CS SS -#define LORA_MISO MISO -#define LORA_MOSI MOSI -#define LORA_RST GPIO_NUM_26 -#define LORA_IRQ GPIO_NUM_36 -#define LORA_IO1 GPIO_NUM_34 // must be wired by you on PCB! -#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 CFG_sx1276_radio 1 // select LoRa chip -#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 -//#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define HAS_LED NOT_A_PIN // no on board LED (?) -#define RGB_LED_COUNT 10 - -#define HAS_RGB_LED SmartLed rgb_led(LED_SK6812, RGB_LED_COUNT, GPIO_NUM_15) // LED_SK6812 RGB LED on GPIO15 -#define HAS_BUTTON (39) // on board button A - -// power management settings -#define HAS_IP5306 1 // has IP5306 chip -#define PMU_CHG_CURRENT 2 // battery charge current -// possible values: 0:200mA, 1:400mA, *2:500mA, 3:600mA -#define PMU_CHG_CUTOFF 0 // battery charge cutoff -// possible values: *0:4.2V, 1:4.3V, 2:4.35V, 3:4.4V - -// GPS settings -#define HAS_GPS 0 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, RXD2, TXD2 // UBlox NEO 6M RX, TX -// #define GPS_INT GPIO_NUM_35 // 30ns accurary timepulse, to be external wired on pcb: shorten R12! - -// Display Settings -#define MY_DISPLAY_WIDTH 320 -#define MY_DISPLAY_HEIGHT 240 -#define MY_DISPLAY_INVERT 1 - -// setting for M5 display -#define USER_SETUP_LOADED 1 -#define ILI9341_DRIVER 1 -#define M5STACK // needed for TFT driver - -#define TFT_MISO MISO // SPI -#define TFT_MOSI MOSI // SPI -#define TFT_SCLK SCK // SPI -#define TFT_CS GPIO_NUM_14 // Chip select control -#define TFT_DC GPIO_NUM_27 // Data Command control -#define TFT_RST GPIO_NUM_33 // Reset -#define TFT_BL GPIO_NUM_32 // LED back-light - -#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red - -//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH -#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters -#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters -//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm -//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. -//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. -//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT -//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts -#define SMOOTH_FONT - -#define SPI_FREQUENCY 40000000 - -#endif \ No newline at end of file diff --git a/src/hal/octopus32.h b/src/hal/octopus32.h deleted file mode 100644 index b7de8b12..00000000 --- a/src/hal/octopus32.h +++ /dev/null @@ -1,49 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board featheresp32 - -#ifndef _OCTOPUS_H -#define _OCTOPUS_H -#include - -// Hardware related definitions for #IoT Octopus32 with the Adafruit LoRaWAN Wing -// You can use this configuration also with the Adafruit ESP32 Feather + the LoRaWAN Wing -// In this config we use the Adafruit OLED Wing which is only 128x32 pixel, need to find a smaller font -// NOTE: if LORA_IRQ and LORA_IO1 are tied to the same GPIO using diodes on the board, -// you must disable LMIC_USE_INTERRUPTS in lmic_config.h - -// disable brownout detection (avoid unexpected reset on some boards) -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -// Octopus32 has a pre-populated BME680 on i2c addr 0x76 -#define HAS_BME 1 // Enable BME sensors in general -#define HAS_BME680 GPIO_NUM_23, GPIO_NUM_22 // SDA, SCL -#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND - -#define HAS_LED 13 // ESP32 GPIO12 (pin22) On Board LED -//#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW -//#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_13) // ESP32 GPIO13 (pin13) On Board Shield WS2812B RGB LED -//#define HAS_BUTTON 15 // ESP32 GPIO15 (pin15) Button is on the LoraNode32 shield -//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // RFM95 module - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (14) -#define LORA_MISO (19) -#define LORA_MOSI (18) -#define LORA_RST LMIC_UNUSED_PIN -#define LORA_IRQ (33) -#define LORA_IO1 (33) -#define LORA_IO2 LMIC_UNUSED_PIN - -// Pins for I2C interface of OLED Display -#define HAS_DISPLAY 1 -//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define MY_DISPLAY_SDA (23) -#define MY_DISPLAY_SCL (22) -#define MY_DISPLAY_RST NOT_A_PIN - -#endif diff --git a/src/hal/olimexpoeiso.h b/src/hal/olimexpoeiso.h deleted file mode 100644 index bd962b94..00000000 --- a/src/hal/olimexpoeiso.h +++ /dev/null @@ -1,30 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32-poe-iso - -#ifndef _OLIMEXPOEISO_H -#define _OLIMEXPOEISO_H - -#include - -// enable only if you want to store a local paxcount table on the device -//#define HAS_SDCARD 2 // this board has a SDMMC card-reader/writer - -// enable only if you want to send paxcount via ethernet port to mqtt server -#define HAS_MQTT 1 // use MQTT on ethernet interface - -//#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery measurement -//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 470k/470k on board -#define BAT_MEASURE_ADC ADC1_GPIO39_CHANNEL // external power sense -#define BAT_VOLTAGE_DIVIDER 2.1277f // voltage divider 47k/100k on board - -#define HAS_BUTTON KEY_BUILTIN // on board button -#define HAS_LED NOT_A_PIN // no on board LED - -//#define HAS_DISPLAY 1 -//#define MY_DISPLAY_FLIP 1 // use if display is rotated -//#define MY_DISPLAY_SDA SDA -//#define MY_DISPLAY_SCL SCL -//#define MY_DISPLAY_RST NOT_A_PIN - -#endif diff --git a/src/hal/tinypico.h b/src/hal/tinypico.h deleted file mode 100644 index 415f793d..00000000 --- a/src/hal/tinypico.h +++ /dev/null @@ -1,24 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - - -#ifndef _TINYPICO_H -#define _TINYPICO_H - -#include - -// Hardware related definitions for crowdsupply tinypico board - -#define HAS_LED NOT_A_PIN // Green LED on board -#define HAS_RGB_LED Apa102 rgb_led(1, GPIO_NUM_12, GPIO_NUM_2) // APA102 RGB LED on board - -//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature -#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 -#define BAT_VOLTAGE_DIVIDER 2.7625f // voltage divider 160k/442k on board -#define BOARD_HAS_PSRAM // use extra 4MB external RAM -#define LED_POWER_SW (13) // switches LED power -#define LED_POWER_ON 0 // switch on transistor for LED power -#define LED_POWER_OFF 1 - -#endif \ No newline at end of file diff --git a/src/hal/tinypicomatrix.h b/src/hal/tinypicomatrix.h deleted file mode 100644 index 73597446..00000000 --- a/src/hal/tinypicomatrix.h +++ /dev/null @@ -1,46 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - - -#ifndef _TINYPICO_H -#define _TINYPICO_H - -#include - -// Hardware related definitions for crowdsupply tinypico board -// for operating a 96x16 shift register LED matrix display - -#define HAS_LED NOT_A_PIN // Green LED on board -#define HAS_RGB_LED Apa102 rgb_led(1, GPIO_NUM_12, GPIO_NUM_2) // APA102 RGB LED on board - -//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature -#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 -#define BAT_VOLTAGE_DIVIDER 2.7625f // voltage divider 160k/442k on board -#define BOARD_HAS_PSRAM // use extra 4MB external RAM -#define LED_POWER_SW (13) // switches LED power -#define LED_POWER_ON 0 // switch on transistor for LED power -#define LED_POWER_OFF 1 - -// LED Matrix display settings -#define HAS_MATRIX_DISPLAY 1 // Uncomment to enable LED matrix display output -#define LED_MATRIX_WIDTH (32*2) // Width (cols) in pixels (LEDs) of your display, must be 32X -#define LED_MATRIX_HEIGHT (16*1) // Height (rows) in pixels (LEDs) of your display, must be 16X - -// Explanation of pin signals see https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring -#define MATRIX_DISPLAY_SCAN_US 500 // Matrix display scan rate in microseconds (1ms is about 'acceptable') -#define LED_MATRIX_LATCHPIN 32 // LAT (or STB = Strobe) -#define LED_MATRIX_CLOCKPIN 33 // CLK -#define LED_MATRIX_EN_74138 21 // EN (or OE) -#define LED_MATRIX_LA_74138 23 // LA (or A) -#define LED_MATRIX_LB_74138 19 // LB (or B) -#define LED_MATRIX_LC_74138 18 // LC (or C) -#define LED_MATRIX_LD_74138 5 // LD (or D) -#define LED_MATRIX_DATA_R1 22 // R1 (or R0) - -// CLK: The clock signal moves the data bits from pin R1 ("red") in the shift registers -// LAT: The latch signal enables LEDs according to the shift register's contents -// Line Selects: LA, LB, LC, LD select which rows of the display are currently lit (0 .. 15) -// OE: Output enable switches the LEDs on/off while transitioning from one row to the next - -#endif \ No newline at end of file diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h deleted file mode 100644 index 76e6ae51..00000000 --- a/src/hal/ttgobeam.h +++ /dev/null @@ -1,44 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board ttgo-t-beam - -#ifndef _TTGOBEAM_H -#define _TTGOBEAM_H - -#include - -// Hardware related definitions for TTGO T-Beam board -// (only) for older T-Beam version T22_V05 eternal wiring LORA_IO1 to GPIO33 is needed! -// -// pinouts taken from http://tinymicros.com/wiki/TTGO_T-Beam - -#define HAS_LED GPIO_NUM_14 // on board green LED, only new version TTGO-BEAM V07 -//#define HAS_LED GPIO_NUM_21 // on board green LED, only old verison TTGO-BEAM V05 - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC -#define HAS_BUTTON GPIO_NUM_39 // on board button (next to reset) -#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 - -// 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 -//#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34 - -// enable only if device has these sensors, otherwise comment these lines -// BME680 sensor on I2C bus -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! - -// display (if connected) -//#define HAS_DISPLAY 1 -#define MY_DISPLAY_SDA SDA -#define MY_DISPLAY_SCL SCL -#define MY_DISPLAY_RST NOT_A_PIN -//#define MY_DISPLAY_FLIP 1 // use if display is rotated - -//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#endif diff --git a/src/hal/ttgobeam10.h b/src/hal/ttgobeam10.h deleted file mode 100644 index 0fc5e8fe..00000000 --- a/src/hal/ttgobeam10.h +++ /dev/null @@ -1,85 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board ttgo-t-beam - -#ifndef _TTGOBEAM_H -#define _TTGOBEAM_H - -#include - -/* -Hardware related definitions for TTGO T-Beam board -for T-Beam version T22_V10 + T22_V11 -pinouts taken from https://github.com/lewisxhe/TTGO-T-Beam - -/// Button functions: /// -Power, short press -> set device on / while device is on: goto sleep -Power, long press -> set device off -User, short press -> flip display page -User, long press -> send a button message -Reset -> reset device -*/ - -#define HAS_DISPLAY 1 -#define MY_DISPLAY_SDA SDA -#define MY_DISPLAY_SCL SCL -#define MY_DISPLAY_RST NOT_A_PIN -//#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC -#define HAS_BUTTON GPIO_NUM_38 // middle on board button -#define HAS_LED GPIO_NUM_4 // not present on all T-Beam 1.0 boards -#define LED_ACTIVE_LOW 1 - -// power management settings -#define HAS_PMU 1 // has AXP192 chip -#define PMU_INT GPIO_NUM_35 // battery interrupt -#define PMU_CHG_CURRENT AXP1XX_CHARGE_CUR_1000MA // battery charge current -// possible values (mA): -// 100/190/280/360/450/550/630/700/780/880/960/1000/1080/1160/1240/1320 -#define PMU_CHG_CUTOFF AXP202_TARGET_VOL_4_2V // battery charge cutoff -// possible values (V): -// 4_1/4_15/4_2/4_36 - -// blue onboard led settings -// possible values: -// AXP20X_LED_OFF / AXP20X_LED_LOW_LEVEL (means LED ON) / AXP20X_LED_BLINK_1HZ / AXP20X_LED_BLINK_4HZ -#define PMU_LED_RUN_MODE AXP20X_LED_LOW_LEVEL -#define PMU_LED_SLEEP_MODE AXP20X_LED_OFF - -// GPS settings -#define HAS_GPS 1 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_34, GPIO_NUM_12 // UBlox NEO 6M -#define GPS_INT GPIO_NUM_37 // 30ns accurary timepulse generated by NEO 6M Pin #3 - -// enable only if device has these sensors, otherwise comment these lines -// BME680 sensor on I2C bus -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! - -//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#endif - -/* - -// T-Beam V10/V11 has on board power management by AXP192 PMU chip: -// -// DCDC1 0.7-3.5V @ 1200mA -> OLED -// DCDC3 0.7-3.5V @ 700mA -> ESP32 (keep this on!) -// LDO1 30mA -> GPS Backup -// LDO2 200mA -> LORA -// LDO3 200mA -> GPS - -// Wiring for I2C OLED display: -// -// Signal Header OLED -// 3V3 7 VCC -// GND 8 GND -// IO22(SCL) 9 SCL -// IO21(SDA) 10 SDA -// - -*/ diff --git a/src/hal/ttgofox.h b/src/hal/ttgofox.h deleted file mode 100644 index dc0a9974..00000000 --- a/src/hal/ttgofox.h +++ /dev/null @@ -1,48 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _TTGOFOX_H -#define _TTGOFOX_H - -#include - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC - -#define HAS_DISPLAY 1 -#define HAS_LED NOT_A_PIN // green on board LED is useless, is GPIO25, which switches power for Lora+Display - -#define EXT_POWER_SW GPIO_NUM_25 // switches power for LoRa chip -#define EXT_POWER_ON 0 -#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL -#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board -#define HAS_BUTTON GPIO_NUM_36 // on board button (next to reset) - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (21) -#define MY_DISPLAY_SCL (22) -#define MY_DISPLAY_RST NOT_A_PIN - -// 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 - -// Settings for IF482 interface -#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters - -// Settings for DCF77 interface -//#define HAS_DCF77 GPIO_NUM_14 -//#define DCF77_ACTIVE_LOW 1 - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST (23) -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 (32) - -#endif diff --git a/src/hal/ttgotdisplay.h b/src/hal/ttgotdisplay.h deleted file mode 100644 index 0011d825..00000000 --- a/src/hal/ttgotdisplay.h +++ /dev/null @@ -1,55 +0,0 @@ -// clang-format off -// upload_speed 1500000 -// board esp32dev - -#ifndef _TTGOTDISPLAY_H -#define _TTGOTDISPLAY_H - -#include - -#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 -#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define HAS_LED NOT_A_PIN // no on board LED (?) -#define HAS_BUTTON (35) // on board button A - -// power management settings -#define BAT_MEASURE_ADC ADC1_GPIO34_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_6 -#define BAT_VOLTAGE_DIVIDER 2.605f // voltage divider - -// Display Settings -#define MY_DISPLAY_WIDTH 135 -#define MY_DISPLAY_HEIGHT 240 -#define MY_DISPLAY_INVERT 1 - -// setting for TTGO T-display -#define USER_SETUP_LOADED 1 -#define ST7789_DRIVER 1 - -#define CGRAM_OFFSET - -#define TFT_MOSI GPIO_NUM_19 // SPI -#define TFT_SCLK GPIO_NUM_18 // SPI -#define TFT_CS GPIO_NUM_5 // Chip select control -#define TFT_DC GPIO_NUM_16 // Data Command control -#define TFT_RST GPIO_NUM_23 // Reset -#define TFT_BL GPIO_NUM_4 // LED back-light - -#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red - -#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH -#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters -#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters -#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm -#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. -#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. -//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT -#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts -#define SMOOTH_FONT - -#define SPI_FREQUENCY 40000000 -#define SPI_READ_FREQUENCY 6000000 - -#endif diff --git a/src/hal/ttgotdisplays3.h b/src/hal/ttgotdisplays3.h index 3e6ee8a1..be9f4f0a 100644 --- a/src/hal/ttgotdisplays3.h +++ b/src/hal/ttgotdisplays3.h @@ -13,7 +13,7 @@ #define MY_DISPLAY_FLIP 1 // use if display is rotated #define HAS_LED NOT_A_PIN // no on board LED (?) -#define HAS_BUTTON (35) // on board button A +#define HAS_BUTTON (14) // on board button A // power management settings //#define BAT_MEASURE_ADC ADC1_GPIO34_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_6 diff --git a/src/hal/ttgotwristband.h b/src/hal/ttgotwristband.h deleted file mode 100644 index a7f48af8..00000000 --- a/src/hal/ttgotwristband.h +++ /dev/null @@ -1,58 +0,0 @@ -// clang-format off -// upload_speed 1500000 -// board pico32 - -#ifndef _TTGOTWRISTBAND_H -#define _TTGOTWRISTBAND_H - -#include - -#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 -#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define HAS_LED NOT_A_PIN // no on board LED (?) -#define HAS_BUTTON (33) // on board button A - -// power management settings -#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 -#define BAT_VOLTAGE_DIVIDER 2.605f // voltage divider - -// Display Settings -#define MY_DISPLAY_WIDTH 80 -#define MY_DISPLAY_HEIGHT 160 -#define MY_DISPLAY_INVERT 1 - -// setting for TTGO T-display -#define USER_SETUP_LOADED 1 -#define ST7735_DRIVER 1 - -#define CGRAM_OFFSET - -#define TFT_MISO -1 -#define TFT_MOSI GPIO_NUM_19 // SPI -#define TFT_SCLK GPIO_NUM_18 // SPI -#define TFT_CS GPIO_NUM_5 // Chip select control -#define TFT_DC GPIO_NUM_23 // Data Command control -#define TFT_RST GPIO_NUM_26 // Reset -#define TFT_BL GPIO_NUM_27 // LED back-light -#define TFT_BACKLIGHT_ON 1 -#define ST7735_GREENTAB160x80 - -#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red - -#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH -#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters -#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters -#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm -#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-. -#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. -#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts -#define SMOOTH_FONT - -#define SPI_FREQUENCY 27000000 -#define SPI_READ_FREQUENCY 6000000 - -#endif - diff --git a/src/hal/ttgov1.h b/src/hal/ttgov1.h deleted file mode 100644 index cc0493c8..00000000 --- a/src/hal/ttgov1.h +++ /dev/null @@ -1,42 +0,0 @@ -// clang-format off -// upload_speed 115200 -// board ttgo-lora32-v1 - -#ifndef _TTGOV1_H -#define _TTGOV1_H - -#include - -// Hardware related definitions for TTGOv1 board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 - -#define HAS_DISPLAY 1 // OLED-Display on board -//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED LED_BUILTIN // set to NOT_A_PIN to disable -#define LED_ACTIVE_LOW 1 // Onboard LED is active when pin is LOW -#define HAS_BUTTON KEY_BUILTIN - -// 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 -// Pins for SD-card -#define SDCARD_CS (13) -#define SDCARD_MOSI (15) -#define SDCARD_MISO (2) -#define SDCARD_SCLK (14) - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (4) -#define MY_DISPLAY_SCL (15) -#define MY_DISPLAY_RST (16) - -// This board reports back the wrong I2C address, so we overwrite it here -#define MY_DISPLAY_ADDR 0x3C - -// Pins for LORA chip SPI interface come from board file, we need some -// additional definitions for LMIC -#define LORA_IO1 (33) -#define LORA_IO2 (32) // ref.: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 - -#endif diff --git a/src/hal/ttgov2.h b/src/hal/ttgov2.h deleted file mode 100644 index 37d58359..00000000 --- a/src/hal/ttgov2.h +++ /dev/null @@ -1,41 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board ttgo-lora32-v1 - -#ifndef _TTGOV2_H -#define _TTGOV2_H - -#include - -// Hardware related definitions for TTGO V2 Board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC - -#define HAS_DISPLAY 1 -//#define MY_DISPLAY_FLIP 1 // uncomment this for rotated display -#define HAS_LED NOT_A_PIN // on-board LED is wired to SCL (used by display) therefore totally useless - -// disable brownout detection (needed on TTGOv2 for battery powered operation) -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -// 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 -// Pins for SD-card -#define SDCARD_CS (13) -#define SDCARD_MOSI (15) -#define SDCARD_MISO (2) -#define SDCARD_SCLK (14) - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (21) -#define MY_DISPLAY_SCL (22) -#define MY_DISPLAY_RST NOT_A_PIN - -// Pins for LORA chip SPI interface come from board file, we need some -// additional definitions for LMIC -#define LORA_RST LMIC_UNUSED_PIN -#define LORA_IO1 (33) -#define LORA_IO2 LMIC_UNUSED_PIN - -#endif diff --git a/src/hal/ttgov21new.h b/src/hal/ttgov21new.h deleted file mode 100644 index 47145374..00000000 --- a/src/hal/ttgov21new.h +++ /dev/null @@ -1,44 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _TTGOV21NEW_H -#define _TTGOV21NEW_H - -#include - -/* Hardware related definitions for TTGO V2.1 Board -// ATTENTION: check your board version! -// This settings are for boards labeled v1.6 or v1.6.1 on pcb, NOT for v1.5 or older -*/ - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC - -// enable only if you want to store a local paxcount table on the device -#define HAS_SDCARD 2 // this board has a SD MMC card-reader/writer -#define SDCARD_SLOTWIDTH 4 // 4-line interface - -#define HAS_DISPLAY 1 -#define HAS_LED (25) // green on board LED -//#define HAS_LED NOT_A_PIN - -#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 - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (21) -#define MY_DISPLAY_SCL (22) -#define MY_DISPLAY_RST NOT_A_PIN - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST (23) -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 (32) - -#endif diff --git a/src/hal/ttgov21old.h b/src/hal/ttgov21old.h deleted file mode 100644 index 5ac72589..00000000 --- a/src/hal/ttgov21old.h +++ /dev/null @@ -1,51 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _TTGOV21OLD_H -#define _TTGOV21OLD_H - -#include - - -/* Hardware related definitions for TTGO V2.1 Board -// ATTENTION: check your board version! -// This settings are for boards without label on pcb, or labeled v1.5 on pcb -// see https://github.com/manuelbl/ttn-esp32/wiki/Boards-and-Pins -*/ - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa -#define CFG_sx1276_radio 1 // HPD13A LoRa SoC -#define HAS_LED NOT_A_PIN // no usable LED on board -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -// 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 -// Pins for SD-card -#define SDCARD_CS (13) -#define SDCARD_MOSI (15) -#define SDCARD_MISO (2) -#define SDCARD_SCLK (14) - -#define HAS_DISPLAY 1 -#define MY_DISPLAY_FLIP 1 // rotated display -//#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 - -// Pins for I2C interface of OLED Display -#define MY_DISPLAY_SDA (21) -#define MY_DISPLAY_SCL (22) -#define MY_DISPLAY_RST NOT_A_PIN - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST LMIC_UNUSED_PIN -// #define LORA_RST (12) // v1.5 labelled with pcb date 20180523 -#define LORA_IRQ (26) -#define LORA_IO1 (33) -#define LORA_IO2 (32) - -#endif \ No newline at end of file diff --git a/src/hal/wemos32matrix.h b/src/hal/wemos32matrix.h deleted file mode 100644 index b69ac074..00000000 --- a/src/hal/wemos32matrix.h +++ /dev/null @@ -1,47 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lolin32 - -#ifndef _WEMOS32MATRIX_H -#define _WEMOS32MATRIX_H - -#include - -#define HAS_LED NOT_A_PIN // no LED - -// LED Matrix display settings -#define HAS_MATRIX_DISPLAY 1 // Uncomment to enable LED matrix display output -#define LED_MATRIX_WIDTH (32*2) // Width (cols) in pixels (LEDs) of your display, must be 32X -#define LED_MATRIX_HEIGHT (16*1) // Height (rows) in pixels (LEDs) of your display, must be 16X - -// Pin numbers work fine for Wemos Lolin32 board (all used pins are on 1 side of the board) -// Explanation of pin signals see https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring -#define MATRIX_DISPLAY_SCAN_US 500 // Matrix display scan rate in microseconds (1ms is about 'acceptable') -#define LED_MATRIX_LATCHPIN 13 // LAT (or STB = Strobe) -#define LED_MATRIX_CLOCKPIN 32 // CLK -#define LED_MATRIX_EN_74138 12 // EN (or OE) -#define LED_MATRIX_LA_74138 14 // LA (or A) -#define LED_MATRIX_LB_74138 27 // LB (or B) -#define LED_MATRIX_LC_74138 25 // LC (or C) -#define LED_MATRIX_LD_74138 26 // LD (or D) -#define LED_MATRIX_DATA_R1 33 // R1 (or R0) - -// CLK: The clock signal moves the data bits from pin R1 ("red") in the shift registers -// LAT: The latch signal enables LEDs according to the shift register's contents -// Line Selects: LA, LB, LC, LD select which rows of the display are currently lit (0 .. 15) -// OE: Output enable switches the LEDs on/off while transitioning from one row to the next - -/* -How it works: - -1. clock out 8 bytes for columns via R1 and CLK (8 * 8 bit -> 64 columns) -2. OE disable (LEDs off) -3. select line to lit with LA/LB/LC/LD hex coded (4 bit -> 16 rows) -4. latch data from shift registers to columns -5. OE enable (LEDs on) -6. repeat with step1 for next line -*/ - -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#endif \ No newline at end of file diff --git a/src/hal/wemos32oled.h b/src/hal/wemos32oled.h deleted file mode 100644 index 1ad3cb28..00000000 --- a/src/hal/wemos32oled.h +++ /dev/null @@ -1,20 +0,0 @@ -// clang-format off -// upload_speed 921600 -// board lolin32 - -#ifndef _WEMOS32OLED_H -#define _WEMOS32OLED_H - -#include - -#define HAS_LED NOT_A_PIN // no LED - -#define HAS_DISPLAY 1 -#define MY_DISPLAY_SDA (5) -#define MY_DISPLAY_SCL (4) -#define MY_DISPLAY_RST NOT_A_PIN -#define MY_DISPLAY_FLIP 1 // use if display is rotated - -#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature - -#endif From 8bb2c75338c862a2246e7d629fa6e8375b26fb09 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Mon, 31 Oct 2022 16:04:09 +0100 Subject: [PATCH 03/16] sdcard & rgbled fixes --- include/globals.h | 2 + include/led.h | 39 ++---- include/sdcard.h | 4 + platformio_orig.ini | 62 ++++++++++ src/hal/m5core.h | 0 src/hal/m5fire.h | 0 src/hal/ttgobeam10.h | 0 src/hal/ttgotdisplays3.h | 24 ---- src/hal/ttgotdongledisplays3.h | 31 +++++ src/hal/ttgotdongles3.h | 21 ++++ src/hal/ttgotwristband.h | 0 src/led.cpp | 213 ++++++++++++--------------------- src/loraconf_sample.h | 88 -------------- src/main.cpp | 12 +- src/sdcard.cpp | 2 +- 15 files changed, 210 insertions(+), 288 deletions(-) delete mode 100644 src/hal/m5core.h delete mode 100644 src/hal/m5fire.h delete mode 100644 src/hal/ttgobeam10.h delete mode 100644 src/hal/ttgotdisplays3.h create mode 100644 src/hal/ttgotdongledisplays3.h create mode 100644 src/hal/ttgotdongles3.h delete mode 100644 src/hal/ttgotwristband.h delete mode 100644 src/loraconf_sample.h diff --git a/include/globals.h b/include/globals.h index 8d57f1dd..35adfb7e 100644 --- a/include/globals.h +++ b/include/globals.h @@ -5,7 +5,9 @@ #include // Time functions +#ifdef HAS_RTC #include +#endif #include // std::set for unified array functions diff --git a/include/led.h b/include/led.h index 6bbef12d..6c3a59bc 100644 --- a/include/led.h +++ b/include/led.h @@ -1,8 +1,9 @@ #ifndef _LED_H #define _LED_H -#ifdef RGB_LED_COUNT -#include +#ifdef HAS_RGB_LED +#include +#include "libpax_helpers.h" #endif #ifdef HAS_LORA #include "lorawan.h" @@ -12,39 +13,13 @@ #define RGB_LED_COUNT 1 #endif -// value for HSL color -// see http://www.workwithcolor.com/blue-color-hue-range-01.htm -#define COLOR_RED 0 -#define COLOR_ORANGE 30 -#define COLOR_ORANGE_YELLOW 45 -#define COLOR_YELLOW 60 -#define COLOR_YELLOW_GREEN 90 -#define COLOR_GREEN 120 -#define COLOR_GREEN_CYAN 165 -#define COLOR_CYAN 180 -#define COLOR_CYAN_BLUE 210 -#define COLOR_BLUE 240 -#define COLOR_BLUE_MAGENTA 275 -#define COLOR_MAGENTA 300 -#define COLOR_PINK 350 -#define COLOR_WHITE 360 -#define COLOR_NONE 999 - -struct RGBColor { - uint8_t R; - uint8_t G; - uint8_t B; -}; - enum led_states { LED_OFF, LED_ON }; - extern TaskHandle_t ledLoopTask; -// Exported Functions -void rgb_set_color(uint16_t hue); -void blink_LED(uint16_t set_color, uint16_t set_blinkduration); +void rgb_led_init(void); +void led_sethue(uint8_t hue); void ledLoop(void *parameter); -void switch_LED(uint8_t state); -void switch_LED1(uint8_t state); +void switch_LED(led_states state); +void switch_LED1(led_states state); #endif \ No newline at end of file diff --git a/include/sdcard.h b/include/sdcard.h index 1f2b0bca..4b1145eb 100644 --- a/include/sdcard.h +++ b/include/sdcard.h @@ -33,6 +33,10 @@ #elif HAS_SDCARD == 2 // MMC interface #include "driver/sdmmc_host.h" +#ifndef SDCARD_SLOTCONFIG +#define SDCARD_SLOTCONFIG SDMMC_SLOT_CONFIG_DEFAULT() +#endif + #ifndef SDCARD_SLOTWIDTH #define SDCARD_SLOTWIDTH 1 #endif diff --git a/platformio_orig.ini b/platformio_orig.ini index e69de29b..750ee7da 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -0,0 +1,62 @@ +[board] +halfile = ttgotdongles3.h +;halfile = ttgotdongledisplays3.h + +[platformio] +; upload firmware to board with usb cable +default_envs = usb +description = Paxcounter is a device for metering passenger flows in realtime. It counts how many mobile devices are around. + +[common] +; for release_version use max. 10 chars total, use any decimal format like "a.b.c" +release_version = 3.3.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 = 5 +extra_scripts = pre:build.py +otakeyfile = ota.conf +lorakeyfile = loraconf.h +lmicconfigfile = lmic_config.h +platform_espressif32 = espressif32@5.2.0 +monitor_speed = 115200 +upload_speed = 115200 ; set by build.py and taken from hal file +lib_deps_all = + bitbank2/BitBang_I2C@^2.2.1 + https://github.com/bitbank2/bb_spi_lcd.git + ;https://github.com/RoboticsBrno/SmartLeds.git + ;greyrook/libpax @ ^1.0.1 + https://github.com/cyberman54/libpax.git + https://github.com/SukkoPera/Arduino-Rokkit-Hash.git + bblanchon/ArduinoJson @ ^6 + spacehuhn/SimpleButton + 256dpi/MQTT @ ^2.5.0 +build_flags_basic = + -include "src/hal/${board.halfile}" + -include "src/paxcounter.conf" + '-DCORE_DEBUG_LEVEL=${common.debug_level}' + '-DLOG_LOCAL_LEVEL=${common.debug_level}' + '-DPROGVERSION="${common.release_version}"' + '-D LIBPAX_WIFI' + '-D LIBPAX_BLE' + '-D LIBPAX_ARDUINO' +build_flags_all = + ${common.build_flags_basic} + -mfix-esp32-psram-cache-issue + +[env] +framework = arduino +board = ESP32-S3-DevKitC-1 +board_build.partitions = min_spiffs.csv +build_type = release +upload_speed = ${common.upload_speed} +;upload_port = COM6 +platform = ${common.platform_espressif32} +lib_deps = ${common.lib_deps_all} +build_flags = ${common.build_flags_all} +upload_protocol = ${common.upload_protocol} +extra_scripts = ${common.extra_scripts} +monitor_speed = ${common.monitor_speed} +monitor_filters = time, esp32_exception_decoder, default + +[env:usb] +upload_protocol = esptool \ No newline at end of file diff --git a/src/hal/m5core.h b/src/hal/m5core.h deleted file mode 100644 index e69de29b..00000000 diff --git a/src/hal/m5fire.h b/src/hal/m5fire.h deleted file mode 100644 index e69de29b..00000000 diff --git a/src/hal/ttgobeam10.h b/src/hal/ttgobeam10.h deleted file mode 100644 index e69de29b..00000000 diff --git a/src/hal/ttgotdisplays3.h b/src/hal/ttgotdisplays3.h deleted file mode 100644 index 0c8f13aa..00000000 --- a/src/hal/ttgotdisplays3.h +++ /dev/null @@ -1,24 +0,0 @@ -// clang-format off -// upload_speed 1500000 -// board ESP32-S3-DevKitC-1 - -#ifndef _TTGOTDISPLAYS3_H -#define _TTGOTDISPLAYS3_H - -#include - -#define HAS_LED NOT_A_PIN -#define HAS_BUTTON 14 // on board button (right side) - -// power management settings -//#define BAT_MEASURE_ADC ADC1_GPIO4_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_6 -//#define BAT_VOLTAGE_DIVIDER 2.605f // voltage divider - -// Display Settings -#define HAS_DISPLAY 2 // TFT-LCD parallel -#define TFT_TYPE DISPLAY_T_DISPLAY_S3 -#define MY_DISPLAY_FLIP 1 // use if display is rotated -#define MY_DISPLAY_WIDTH 172 -#define MY_DISPLAY_HEIGHT 320 - -#endif \ No newline at end of file diff --git a/src/hal/ttgotdongledisplays3.h b/src/hal/ttgotdongledisplays3.h new file mode 100644 index 00000000..beada2d6 --- /dev/null +++ b/src/hal/ttgotdongledisplays3.h @@ -0,0 +1,31 @@ +// clang-format off +// upload_speed 1500000 +// board ESP32-S3-DevKitC-1 + +// see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 + +#ifndef _TTGOTDONGLES3_H +#define _TTGOTDONGLES3_H + +#include + +#define HAS_LED NOT_A_PIN +#define HAS_BUTTON 0 + +#define HAS_SDCARD 2 // this board has a SD MMC card-reader/writer +#define SDCARD_SLOTWIDTH 4 // 4-line interface + +#define HAS_DISPLAY 2 // TFT-LCD +#define TFT_TYPE DISPLAY_TDONGLE_S3 +#define MY_DISPLAY_FLIP 1 // use if display is rotated +#define MY_DISPLAY_WIDTH 80 +#define MY_DISPLAY_HEIGHT 160 + +#define TFT_CS_PIN 4 +#define TFT_SDA_PIN 3 +#define TFT_SCL_PIN 5 +#define TFT_DC_PIN 2 +#define TFT_RES_PIN 1 +#define TFT_LEDA_PIN 38 + +#endif \ No newline at end of file diff --git a/src/hal/ttgotdongles3.h b/src/hal/ttgotdongles3.h new file mode 100644 index 00000000..16ed7784 --- /dev/null +++ b/src/hal/ttgotdongles3.h @@ -0,0 +1,21 @@ +// clang-format off +// upload_speed 1500000 +// board ESP32-S3-DevKitC-1 + +// for pinouts see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 + +#ifndef _TTGOTDONGLES3_H +#define _TTGOTDONGLES3_H + +#include + +#define HAS_LED NOT_A_PIN +#define RGB_LED_COUNT 1 +#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT) +#define FASTLED_INTERNAL +#define HAS_BUTTON 0 // dongle button is on GPIO0 +#define HAS_SDCARD 2 // dongle has a SD MMC card-reader/writer +#define SDCARD_SLOTWIDTH 4 // dongle has 4 line interface +#define SDCARD_SLOTCONFIG { .clk = GPIO_NUM_12, .cmd = GPIO_NUM_16, .d0 = GPIO_NUM_14, .d1 = GPIO_NUM_17, .d2 = GPIO_NUM_21, .d3 = GPIO_NUM_18, .cd = SDMMC_SLOT_NO_CD, .wp = SDMMC_SLOT_NO_WP, .width = 4, .flags = 0, } + +#endif \ No newline at end of file diff --git a/src/hal/ttgotwristband.h b/src/hal/ttgotwristband.h deleted file mode 100644 index e69de29b..00000000 diff --git a/src/led.cpp b/src/led.cpp index ecd5b99a..a09cb1b3 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -2,140 +2,89 @@ #include "globals.h" #include "led.h" -led_states LEDState = LED_OFF; // LED state global for state machine -led_states previousLEDState = - LED_ON; // This will force LED to be off at boot since State is OFF - +static led_states LEDState = LED_OFF; // LED state global for state machine TaskHandle_t ledLoopTask; - -uint16_t LEDColor = COLOR_NONE, LEDBlinkDuration = 0; // state machine variables -unsigned long LEDBlinkStarted = 0; // When (in millis() led blink started) +static uint16_t LEDBlinkDuration = 0; // state machine variables +static unsigned long LEDBlinkStarted = + 0; // When (in millis() led blink started) #ifdef HAS_RGB_LED - -// RGB Led instance -HAS_RGB_LED; - -float rgb_CalcColor(float p, float q, float t) { - if (t < 0.0f) - t += 1.0f; - if (t > 1.0f) - t -= 1.0f; - - if (t < 1.0f / 6.0f) - return p + (q - p) * 6.0f * t; - - if (t < 0.5f) - return q; - - if (t < 2.0f / 3.0f) - return p + ((q - p) * (2.0f / 3.0f - t) * 6.0f); - - return p; -} - -// ------------------------------------------------------------------------ -// Hue, Saturation, Lightness color members -// HslColor using H, S, L values (0.0 - 1.0) -// L should be limited to between (0.0 - 0.5) -// ------------------------------------------------------------------------ -RGBColor rgb_hsl2rgb(float h, float s, float l) { - RGBColor RGB_color; - float r; - float g; - float b; - - if (s == 0.0f || l == 0.0f) { - r = g = b = l; // achromatic or black - } else { - float q = l < 0.5f ? l * (1.0f + s) : l + s - (l * s); - float p = 2.0f * l - q; - r = rgb_CalcColor(p, q, h + 1.0f / 3.0f); - g = rgb_CalcColor(p, q, h); - b = rgb_CalcColor(p, q, h - 1.0f / 3.0f); - } - - RGB_color.R = (uint8_t)(r * 255.0f); - RGB_color.G = (uint8_t)(g * 255.0f); - RGB_color.B = (uint8_t)(b * 255.0f); - - return RGB_color; -} - -void rgb_set_color(uint16_t hue) { - if (hue == COLOR_NONE) { - // set Off - for (int i = 0; i < RGB_LED_COUNT; i++) - rgb_led[i] = Rgb(0, 0, 0); - } else { - // see http://www.workwithcolor.com/blue-color-hue-range-01.htm - // H (is color from 0..360) should be between 0.0 and 1.0 - // S is saturation keep it to 1 - // L is brightness should be between 0.0 and 0.5 - // cfg.rgblum is between 0 and 100 (percent) - RGBColor target = rgb_hsl2rgb(hue / 360.0f, 1.0f, 0.005f * cfg.rgblum); - // uint32_t color = target.R<<16 | target.G<<8 | target.B; - for (int i = 0; i < RGB_LED_COUNT; i++) - rgb_led[i] = Rgb(target.R, target.G, target.B); - } - // Show - rgb_led.show(); -} - -#else - -// No RGB LED empty functions -void rgb_set_color(uint16_t hue) {} - +CRGB leds[RGB_LED_COUNT]; #endif -void switch_LED(uint8_t state) { +void led_setcolor(CRGB color) { +#ifdef HAS_RGB_LED + for (int i = 0; i < RGB_LED_COUNT; i++) + leds[i] = color; + FastLED.show(); +#endif +} + +void led_sethue(uint8_t hue) { +#ifdef HAS_RGB_LED + for (int i = 0; i < RGB_LED_COUNT; i++) + leds[i] = CHSV(hue, 0XFF, 100); + FastLED.show(); +#endif +} + +void rgb_led_init(void) { +#ifdef HAS_RGB_LED + HAS_RGB_LED; + led_setcolor(CRGB::Green); +#endif +} + +void switch_LED(led_states state) { + static led_states previousLEDState = LED_OFF; + // led need to change state? avoid digitalWrite() for nothing + if (state != previousLEDState) { + previousLEDState = state; #if (HAS_LED != NOT_A_PIN) - if (state == LED_ON) { - // switch LED on + if (state == LED_ON) { + // switch LED on #ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, LOW); + digitalWrite(HAS_LED, LOW); #else - digitalWrite(HAS_LED, HIGH); + digitalWrite(HAS_LED, HIGH); #endif - } else if (state == LED_OFF) { - // switch LED off + led_setcolor(CRGB::White); + } else if (state == LED_OFF) { + // switch LED off #ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, HIGH); + digitalWrite(HAS_LED, HIGH); #else - digitalWrite(HAS_LED, LOW); + digitalWrite(HAS_LED, LOW); +#endif + led_setcolor(CRGB::Black); + } #endif } -#endif } -void switch_LED1(uint8_t state) { -#ifdef HAS_TWO_LED - if (state == LED_ON) { - // switch LED on -#ifdef LED1_ACTIVE_LOW - digitalWrite(HAS_TWO_LED, LOW); +void switch_LED1(led_states state) { + static led_states previousLEDState = LED_OFF; + // led need to change state? avoid digitalWrite() for nothing + if (state != previousLEDState) { + previousLEDState = state; +#if (HAS_LED != NOT_A_PIN) + if (state == LED_ON) { + // switch LED on +#ifdef LED_ACTIVE_LOW + digitalWrite(HAS_TWO_LED, LOW); #else - digitalWrite(HAS_TWO_LED, HIGH); + digitalWrite(HAS_TWO_LED, HIGH); #endif - } else if (state == LED_OFF) { - // switch LED off -#ifdef LED1_ACTIVE_LOW - digitalWrite(HAS_TWO_LED, HIGH); + } else if (state == LED_OFF) { + // switch LED off +#ifdef LED_ACTIVE_LOW + digitalWrite(HAS_TWO_LED, HIGH); #else - digitalWrite(HAS_TWO_LED, LOW); + digitalWrite(HAS_TWO_LED, LOW); +#endif + } #endif } -#endif // HAS_TWO_LED -} - -void blink_LED(uint16_t set_color, uint16_t set_blinkduration) { -#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) - LEDColor = set_color; // set color for RGB LED - LEDBlinkDuration = set_blinkduration; // duration - LEDBlinkStarted = millis(); // Time Start here - LEDState = LED_ON; // Let main set LED on -#endif } #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) @@ -151,7 +100,7 @@ void ledLoop(void *parameter) { LEDState = LED_OFF; LEDBlinkStarted = 0; LEDBlinkDuration = 0; - LEDColor = COLOR_NONE; + led_setcolor(CRGB::Black); } else { // In case of LoRaWAN led management blinked off LEDState = LED_ON; @@ -161,7 +110,7 @@ void ledLoop(void *parameter) { #if (HAS_LORA) // LED indicators for viusalizing LoRaWAN state if (LMIC.opmode & (OP_JOINING | OP_REJOIN)) { - LEDColor = COLOR_YELLOW; + led_setcolor(CRGB::Yellow); // quick blink 20ms on each 1/5 second LEDState = ((millis() % 200) < 20) ? LED_ON : LED_OFF; // TX data pending @@ -169,13 +118,13 @@ void ledLoop(void *parameter) { // select color to blink by message port switch (LMIC.pendTxPort) { case STATUSPORT: - LEDColor = COLOR_PINK; + led_setcolor(CRGB::Pink); break; case CONFIGPORT: - LEDColor = COLOR_CYAN; + led_setcolor(CRGB::Cyan); break; default: - LEDColor = COLOR_BLUE; + led_setcolor(CRGB::Blue); break; } // small blink 10ms on each 1/2sec (not when joining) @@ -183,33 +132,23 @@ void ledLoop(void *parameter) { // This should not happen so indicate a problem } else if (LMIC.opmode & ((OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0)) { - LEDColor = COLOR_RED; + led_setcolor(CRGB::Red); // heartbeat long blink 200ms on each 2 seconds LEDState = ((millis() % 2000) < 200) ? LED_ON : LED_OFF; } else +#elif (defined(HAS_RGB_LED) && ((WIFICOUNTER) || (BLECOUNTER))) + struct count_payload_t count; + libpax_counter_count(&count); + led_sethue(count.pax); #endif // HAS_LORA { // led off - LEDColor = COLOR_NONE; LEDState = LED_OFF; } } - // led need to change state? avoid digitalWrite() for nothing - if (LEDState != previousLEDState) { - if (LEDState == LED_ON) { - rgb_set_color(LEDColor); - // if we have only single LED we use it to blink for status -#ifndef HAS_RGB_LED - switch_LED(LED_ON); -#endif - } else { - rgb_set_color(COLOR_NONE); -#ifndef HAS_RGB_LED - switch_LED(LED_OFF); -#endif - } - previousLEDState = LEDState; - } + + switch_LED(LEDState); + // give yield to CPU delay(5); } // while(1) diff --git a/src/loraconf_sample.h b/src/loraconf_sample.h deleted file mode 100644 index 3b7d9cb2..00000000 --- a/src/loraconf_sample.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __LORACONF_H__ -#define __LORACONF_H__ - -#if (HAS_LORA) - -/************************************************************ - * LMIC LoRaWAN configuration - * - * Read the values from TTN console (or whatever applies), insert them here, - * and rename this file to src/loraconf.h - * - * You can configure OTAA or ABP Activation. In order to use ABP, uncomment - * (enable) the following line, but you should only do so, if you have good - * reasons for not using OTAA. - * - *************************************************************/ - -//#define LORA_ABP - -#ifndef LORA_ABP -/************************************************************ - * OTAA configuration - * - * DEVEUI, APPEUI and APPKEY should all be specified in MSB format as - * displayed in TTN console, so you can cut & paste from there. This is different - * from standard LMIC-Arduino which expects DEVEUI and APPEUI in LSB format. - * For TTN, APPEUI in MSB format always starts with 0x70, 0xB3, 0xD5. - * Set your DEVEUI here, if your device has have a fixed one. - * If you leave this untouched, then the DEVEUI will be derived from device's - * MAC adress during startup and will be displayed on device's screen as well as - * on serial console, if you set 'verbose 1' in paxcounter.conf and - * 'debug_level 3' in platformio.ini. - * If using a board with Microchip 24AA02E64 Uinique ID for deveui, the DEVEUI - * will be overwritten by the one contained in the Microchip module. - * - ************************************************************/ - -static const u1_t DEVEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const u1_t APPEUI[8] = {0x70, 0xB3, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const u1_t APPKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -#endif - -#ifdef LORA_ABP -/************************************************************ - * ABP configuration (for development) - * - * Get your - * - Network Session Key (NWKSKEY) - * - App Session Key and your (APPSKEY) - * - Device Address (DEVADDR) - * from e.g. TTN console and replace the example values below. - * - * NOTE: Use MSB format (as displayed in TTN console, so you can cut & paste - * from there) - * - * NOTE: You may also need to adjust lorawan_abp.cpp in order to configure - * different channels and data rate channels to match your country's regulations - * and your network's settings. - * - ************************************************************/ - -// ID of LoRaAlliance assigned Network (for a list, see e.g. here -// https://www.thethingsnetwork.org/docs/lorawan/prefix-assignments.html) -static const u1_t NETID = 0x13; // TTN - -static const u1_t NWKSKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; - -static const u1_t APPSKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; - -static const u4_t DEVADDR = - 0x00000000; // <-- Change this address for every node! - -// set additional ABP parameters in loraconf_abp.cpp -void setABPParameters(); - -#endif - -#endif // HAS_LORA - -#endif // __LORACONF_H__ diff --git a/src/main.cpp b/src/main.cpp index 00a8bf2e..9d613b6e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -201,26 +201,26 @@ void setup() { #endif // initialize leds +#ifdef HAS_RGB_LED + rgb_led_init(); + strcat_P(features, " RGB"); +#endif + #if (HAS_LED != NOT_A_PIN) pinMode(HAS_LED, OUTPUT); strcat_P(features, " LED"); - #ifdef LED_POWER_SW pinMode(LED_POWER_SW, OUTPUT); digitalWrite(LED_POWER_SW, LED_POWER_ON); #endif - #ifdef HAS_TWO_LED pinMode(HAS_TWO_LED, OUTPUT); strcat_P(features, " LED2"); #endif - -// use LED for power display if we have additional RGB LED, else for status #ifdef HAS_RGB_LED + // use simple LED for power display if we have additional RGB LED, else for status switch_LED(LED_ON); - strcat_P(features, " RGB"); #endif - #endif // HAS_LED #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) diff --git a/src/sdcard.cpp b/src/sdcard.cpp index d4c23e46..54414233 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -132,7 +132,7 @@ bool sdcard_init(bool create) { // has these signals. // Default config for SDMMC_HOST_DEFAULT (4-bit bus width, slot 1) // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdmmc_host.html - sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); + sdmmc_slot_config_t slot_config = SDCARD_SLOTCONFIG; // Set 1-line or 4-line SD mode (default is 1-line) slot_config.width = SDCARD_SLOTWIDTH; From 57cd6778a642ecdf6d8250a272edb3614f203872 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Mon, 31 Oct 2022 16:07:29 +0100 Subject: [PATCH 04/16] Update platformio_orig.ini --- platformio_orig.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 750ee7da..eccf7da7 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -23,7 +23,7 @@ upload_speed = 115200 ; set by build.py and taken from hal file lib_deps_all = bitbank2/BitBang_I2C@^2.2.1 https://github.com/bitbank2/bb_spi_lcd.git - ;https://github.com/RoboticsBrno/SmartLeds.git + fastled/FastLED @ ^3.5.0 ;greyrook/libpax @ ^1.0.1 https://github.com/cyberman54/libpax.git https://github.com/SukkoPera/Arduino-Rokkit-Hash.git @@ -59,4 +59,4 @@ monitor_speed = ${common.monitor_speed} monitor_filters = time, esp32_exception_decoder, default [env:usb] -upload_protocol = esptool \ No newline at end of file +upload_protocol = esptool From 55737647a1180029d691ec0022c5b3582ea22683 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Mon, 31 Oct 2022 18:44:04 +0100 Subject: [PATCH 05/16] fix color control --- include/led.h | 17 +++++++- src/led.cpp | 113 ++++++++++++++++++++++++-------------------------- 2 files changed, 70 insertions(+), 60 deletions(-) diff --git a/include/led.h b/include/led.h index 6c3a59bc..4bf4c0d8 100644 --- a/include/led.h +++ b/include/led.h @@ -2,9 +2,11 @@ #define _LED_H #ifdef HAS_RGB_LED +#define FASTLED_INTERNAL #include #include "libpax_helpers.h" #endif + #ifdef HAS_LORA #include "lorawan.h" #endif @@ -14,10 +16,23 @@ #endif enum led_states { LED_OFF, LED_ON }; + +enum colors { + COLOR_WHITE = 0xFFFFFF, + COLOR_NONE = 0x000000, + COLOR_CYAN = 0x00FFFF, + COLOR_BLUE = 0x0000FF, + COLOR_GREEN = 0x008000, + COLOR_YELLOW = 0xFFFF00, + COLOR_ORANGE = 0xFFA500, + COLOR_RED = 0xFF0000, + COLOR_PINK = 0xFFC0CB +}; + extern TaskHandle_t ledLoopTask; void rgb_led_init(void); -void led_sethue(uint8_t hue); +void rgb_set_color(uint32_t color); void ledLoop(void *parameter); void switch_LED(led_states state); void switch_LED1(led_states state); diff --git a/src/led.cpp b/src/led.cpp index a09cb1b3..ee6c7e29 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -3,8 +3,12 @@ #include "led.h" static led_states LEDState = LED_OFF; // LED state global for state machine +led_states previousLEDState = + LED_ON; // This will force LED to be off at boot since State is OFF + TaskHandle_t ledLoopTask; -static uint16_t LEDBlinkDuration = 0; // state machine variables + +uint32_t LEDColor = COLOR_NONE, LEDBlinkDuration = 0; // state machine variables static unsigned long LEDBlinkStarted = 0; // When (in millis() led blink started) @@ -12,18 +16,10 @@ static unsigned long LEDBlinkStarted = CRGB leds[RGB_LED_COUNT]; #endif -void led_setcolor(CRGB color) { +void rgb_set_color(uint32_t color) { #ifdef HAS_RGB_LED for (int i = 0; i < RGB_LED_COUNT; i++) - leds[i] = color; - FastLED.show(); -#endif -} - -void led_sethue(uint8_t hue) { -#ifdef HAS_RGB_LED - for (int i = 0; i < RGB_LED_COUNT; i++) - leds[i] = CHSV(hue, 0XFF, 100); + leds[i] = CRGB(color); FastLED.show(); #endif } @@ -31,62 +27,51 @@ void led_sethue(uint8_t hue) { void rgb_led_init(void) { #ifdef HAS_RGB_LED HAS_RGB_LED; - led_setcolor(CRGB::Green); + rgb_set_color(COLOR_NONE); #endif } void switch_LED(led_states state) { - static led_states previousLEDState = LED_OFF; - // led need to change state? avoid digitalWrite() for nothing - if (state != previousLEDState) { - previousLEDState = state; #if (HAS_LED != NOT_A_PIN) - if (state == LED_ON) { - // switch LED on + if (state == LED_ON) { + // switch LED on #ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, LOW); + digitalWrite(HAS_LED, LOW); #else - digitalWrite(HAS_LED, HIGH); + digitalWrite(HAS_LED, HIGH); #endif - led_setcolor(CRGB::White); - } else if (state == LED_OFF) { - // switch LED off + } else if (state == LED_OFF) { + // switch LED off #ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, HIGH); + digitalWrite(HAS_LED, HIGH); #else - digitalWrite(HAS_LED, LOW); -#endif - led_setcolor(CRGB::Black); - } + digitalWrite(HAS_LED, LOW); #endif } +#endif } void switch_LED1(led_states state) { - static led_states previousLEDState = LED_OFF; - // led need to change state? avoid digitalWrite() for nothing - if (state != previousLEDState) { - previousLEDState = state; -#if (HAS_LED != NOT_A_PIN) - if (state == LED_ON) { - // switch LED on -#ifdef LED_ACTIVE_LOW - digitalWrite(HAS_TWO_LED, LOW); +#ifdef HAS_TWO_LED + if (state == LED_ON) { + // switch LED on +#ifdef LED1_ACTIVE_LOW + digitalWrite(HAS_TWO_LED, LOW); #else - digitalWrite(HAS_TWO_LED, HIGH); + digitalWrite(HAS_TWO_LED, HIGH); #endif - } else if (state == LED_OFF) { - // switch LED off -#ifdef LED_ACTIVE_LOW - digitalWrite(HAS_TWO_LED, HIGH); + } else if (state == LED_OFF) { + // switch LED off +#ifdef LED1_ACTIVE_LOW + digitalWrite(HAS_TWO_LED, HIGH); #else - digitalWrite(HAS_TWO_LED, LOW); -#endif - } + digitalWrite(HAS_TWO_LED, LOW); #endif } +#endif // HAS_TWO_LED } + #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) void ledLoop(void *parameter) { @@ -100,7 +85,7 @@ void ledLoop(void *parameter) { LEDState = LED_OFF; LEDBlinkStarted = 0; LEDBlinkDuration = 0; - led_setcolor(CRGB::Black); + LEDColor = COLOR_NONE; } else { // In case of LoRaWAN led management blinked off LEDState = LED_ON; @@ -110,7 +95,7 @@ void ledLoop(void *parameter) { #if (HAS_LORA) // LED indicators for viusalizing LoRaWAN state if (LMIC.opmode & (OP_JOINING | OP_REJOIN)) { - led_setcolor(CRGB::Yellow); + LEDColor = COLOR_YELLOW; // quick blink 20ms on each 1/5 second LEDState = ((millis() % 200) < 20) ? LED_ON : LED_OFF; // TX data pending @@ -118,13 +103,13 @@ void ledLoop(void *parameter) { // select color to blink by message port switch (LMIC.pendTxPort) { case STATUSPORT: - led_setcolor(CRGB::Pink); + LEDColor = COLOR_PINK; break; case CONFIGPORT: - led_setcolor(CRGB::Cyan); + LEDColor = COLOR_CYAN; break; default: - led_setcolor(CRGB::Blue); + LEDColor = COLOR_BLUE; break; } // small blink 10ms on each 1/2sec (not when joining) @@ -132,26 +117,36 @@ void ledLoop(void *parameter) { // This should not happen so indicate a problem } else if (LMIC.opmode & ((OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0)) { - led_setcolor(CRGB::Red); + LEDColor = COLOR_RED; // heartbeat long blink 200ms on each 2 seconds LEDState = ((millis() % 2000) < 200) ? LED_ON : LED_OFF; } else -#elif (defined(HAS_RGB_LED) && ((WIFICOUNTER) || (BLECOUNTER))) - struct count_payload_t count; - libpax_counter_count(&count); - led_sethue(count.pax); #endif // HAS_LORA { // led off + LEDColor = COLOR_NONE; LEDState = LED_OFF; } } - - switch_LED(LEDState); - + // led need to change state? avoid digitalWrite() for nothing + if (LEDState != previousLEDState) { + if (LEDState == LED_ON) { + rgb_set_color(LEDColor); + // if we have only single LED we use it to blink for status +#ifndef HAS_RGB_LED + switch_LED(LED_ON); +#endif + } else { + rgb_set_color(COLOR_NONE); +#ifndef HAS_RGB_LED + switch_LED(LED_OFF); +#endif + } + previousLEDState = LEDState; + } // give yield to CPU delay(5); } // while(1) }; // ledloop() -#endif // #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) +#endif // #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) \ No newline at end of file From a80ea4454ea23788a8f013b721817fa1908e28aa Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Wed, 2 Nov 2022 16:09:27 +0100 Subject: [PATCH 06/16] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2474657d..00adb7e1 100644 --- a/README.md +++ b/README.md @@ -607,3 +607,4 @@ Thanks to - [sbamueller](https://github.com/sbamueller) for writing the tutorial in Make Magazine - [Stefan](https://github.com/nerdyscout) for paxcounter opensensebox integration - [August Quint](https://github.com/AugustQu) for adding SD card data logger and SDS011 support +- [t-huyeng](https://github.com/t-huyeng) for adding a CI workflow to this project From d14f01ca392eebf2c7de154245aa8221a53e2b89 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 4 Nov 2022 11:01:09 +0100 Subject: [PATCH 07/16] remove display_library env var --- platformio_orig.ini | 1 - src/hal/generic.h | 1 - 2 files changed, 2 deletions(-) diff --git a/platformio_orig.ini b/platformio_orig.ini index 979933bf..59cbb1c9 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -57,7 +57,6 @@ lmicconfigfile = lmic_config.h platform_espressif32 = espressif32@5.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 = diff --git a/src/hal/generic.h b/src/hal/generic.h index c753ba8d..42849c45 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -1,7 +1,6 @@ // clang-format off // upload_speed 115200 // board esp32dev -// display_library lib_deps_oled_display #ifndef _GENERIC_H #define _GENERIC_H From 72a4bf4b736ff1578a4156a02aa208afecdad4b8 Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 14:41:55 +0100 Subject: [PATCH 08/16] S3-usb-stick workflow --- .github/workflows/build.yml | 54 ++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7551c2fd..8a54f01f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,17 +14,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - # os: [ubuntu-latest, windows-latest, macos-latest] include: - os: ubuntu-latest path: ~/.cache/pip platformio-path: ~/.platformio - # - os: macos-latest - # path: ~/Library/Caches/pip - # platformio-path: ~/Library/Caches/platformio - # - os: windows-latest - # path: ~\AppData\Local\pip\Cache - # platformio-path: ~\AppData\Local\platformio\Cache board: [ generic.h, @@ -94,3 +87,50 @@ jobs: env: CI_HALFILE: ${{ matrix.board }} run: pio run -e ci + + build-s3-usb-stick: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + include: + - os: ubuntu-latest + path: ~/.cache/pip + platformio-path: ~/.platformio + board: [ttgotdongles3.h, ttgotdongledisplays3.h] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Cache pip + uses: actions/cache@v3 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Cache PlatformIO + uses: actions/cache@v3 + with: + path: ${{ matrix.platformio-path }} + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9.13" + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + - name: Copy of necessary files + run: | + cp platformio_orig_s3-usb-stick.ini platformio.ini + cp src/loraconf_sample.h src/loraconf.h + cp src/ota_sample.conf src/ota.conf + cp src/paxcounter_orig.conf src/paxcounter.conf + - name: Clean + run: pio run -t clean -e usb + - name: Run PlatformIO CI for ${{ matrix.board }} + env: + CI_HALFILE: ${{ matrix.board }} + run: pio run -e usb From 887b082ed6a508983fcc19234c16dfb45566f2bc Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 15:11:54 +0100 Subject: [PATCH 09/16] added ci env --- .github/workflows/build.yml | 4 ++-- platformio_orig_s3-usb-stick.ini | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a54f01f..a39a5c40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,8 +129,8 @@ jobs: cp src/ota_sample.conf src/ota.conf cp src/paxcounter_orig.conf src/paxcounter.conf - name: Clean - run: pio run -t clean -e usb + run: pio run -t clean -e ci - name: Run PlatformIO CI for ${{ matrix.board }} env: CI_HALFILE: ${{ matrix.board }} - run: pio run -e usb + run: pio run -e ci diff --git a/platformio_orig_s3-usb-stick.ini b/platformio_orig_s3-usb-stick.ini index 244972a4..97dd68c9 100644 --- a/platformio_orig_s3-usb-stick.ini +++ b/platformio_orig_s3-usb-stick.ini @@ -31,7 +31,6 @@ lib_deps_all = spacehuhn/SimpleButton 256dpi/MQTT @ ^2.5.0 build_flags_basic = - -include "src/hal/${board.halfile}" -include "src/paxcounter.conf" '-DCORE_DEBUG_LEVEL=${common.debug_level}' '-DLOG_LOCAL_LEVEL=${common.debug_level}' @@ -52,11 +51,19 @@ upload_speed = ${common.upload_speed} ;upload_port = COM6 platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} -build_flags = ${common.build_flags_all} +build_flags = + -include "src/hal/${board.halfile}" + ${common.build_flags_all} upload_protocol = ${common.upload_protocol} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} monitor_filters = time, esp32_exception_decoder, default [env:usb] +upload_protocol = esptool + +[env:ci] +build_flags = + -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI + ${common.build_flags_all} upload_protocol = esptool \ No newline at end of file From bdf4eba0d018fab059fb6a71e7afc00e72e49827 Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 15:20:10 +0100 Subject: [PATCH 10/16] update board name, see: https://docs.platformio.org/en/latest/boards/espressif32/esp32-s3-devkitc-1.html --- platformio_orig_s3-usb-stick.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio_orig_s3-usb-stick.ini b/platformio_orig_s3-usb-stick.ini index 97dd68c9..6a1b852b 100644 --- a/platformio_orig_s3-usb-stick.ini +++ b/platformio_orig_s3-usb-stick.ini @@ -44,7 +44,7 @@ build_flags_all = [env] framework = arduino -board = ESP32-S3-DevKitC-1 +board = esp32-s3-devkitc-1 board_build.partitions = min_spiffs.csv build_type = release upload_speed = ${common.upload_speed} From e87b7be7d266a6c85e566db38360cb9412f7244e Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 15:23:34 +0100 Subject: [PATCH 11/16] updated board name in hal files as well --- src/hal/ttgotdongledisplays3.h | 2 +- src/hal/ttgotdongles3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/ttgotdongledisplays3.h b/src/hal/ttgotdongledisplays3.h index beada2d6..f022ae86 100644 --- a/src/hal/ttgotdongledisplays3.h +++ b/src/hal/ttgotdongledisplays3.h @@ -1,6 +1,6 @@ // clang-format off // upload_speed 1500000 -// board ESP32-S3-DevKitC-1 +// board esp32-s3-devkitc-1 // see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 diff --git a/src/hal/ttgotdongles3.h b/src/hal/ttgotdongles3.h index 16ed7784..caee4780 100644 --- a/src/hal/ttgotdongles3.h +++ b/src/hal/ttgotdongles3.h @@ -1,6 +1,6 @@ // clang-format off // upload_speed 1500000 -// board ESP32-S3-DevKitC-1 +// board esp32-s3-devkitc-1 // for pinouts see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 From c2d99bc85861f29e3101557bb8a0de3dd701440c Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 15:51:29 +0100 Subject: [PATCH 12/16] fixed ttgotdongledisplays3 display errors --- platformio_orig_s3-usb-stick.ini | 1 + src/hal/ttgotdisplays3.h | 2 +- src/hal/ttgotdongledisplays3.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platformio_orig_s3-usb-stick.ini b/platformio_orig_s3-usb-stick.ini index 6a1b852b..b51b27cc 100644 --- a/platformio_orig_s3-usb-stick.ini +++ b/platformio_orig_s3-usb-stick.ini @@ -30,6 +30,7 @@ lib_deps_all = bblanchon/ArduinoJson @ ^6 spacehuhn/SimpleButton 256dpi/MQTT @ ^2.5.0 + ricmoo/QRCode @ ^0.0.1 build_flags_basic = -include "src/paxcounter.conf" '-DCORE_DEBUG_LEVEL=${common.debug_level}' diff --git a/src/hal/ttgotdisplays3.h b/src/hal/ttgotdisplays3.h index 0c8f13aa..108dae1e 100644 --- a/src/hal/ttgotdisplays3.h +++ b/src/hal/ttgotdisplays3.h @@ -1,6 +1,6 @@ // clang-format off // upload_speed 1500000 -// board ESP32-S3-DevKitC-1 +// board esp32-s3-devkitc-1 #ifndef _TTGOTDISPLAYS3_H #define _TTGOTDISPLAYS3_H diff --git a/src/hal/ttgotdongledisplays3.h b/src/hal/ttgotdongledisplays3.h index f022ae86..e198275c 100644 --- a/src/hal/ttgotdongledisplays3.h +++ b/src/hal/ttgotdongledisplays3.h @@ -16,7 +16,7 @@ #define SDCARD_SLOTWIDTH 4 // 4-line interface #define HAS_DISPLAY 2 // TFT-LCD -#define TFT_TYPE DISPLAY_TDONGLE_S3 +#define TFT_TYPE DISPLAY_T_DISPLAY_S3 #define MY_DISPLAY_FLIP 1 // use if display is rotated #define MY_DISPLAY_WIDTH 80 #define MY_DISPLAY_HEIGHT 160 From 79fa8378cb398aefb723ccf6b98b3a5d68a6b55b Mon Sep 17 00:00:00 2001 From: Tim Huyeng Date: Fri, 4 Nov 2022 17:48:21 +0100 Subject: [PATCH 13/16] added windows and macos os for build testing --- .github/workflows/build.yml | 58 ++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a39a5c40..27e89881 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,15 +88,71 @@ jobs: CI_HALFILE: ${{ matrix.board }} run: pio run -e ci + build-windows-macos: + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest] + include: + - os: macos-latest + path: ~/Library/Caches/pip + platformio-path: ~/Library/Caches/platformio + - os: windows-latest + path: ~\AppData\Local\pip\Cache + platformio-path: ~\AppData\Local\platformio\Cache + board: [generic.h, ttgov21new.h] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Cache pip + uses: actions/cache@v3 + with: + path: ${{ matrix.path }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Cache PlatformIO + uses: actions/cache@v3 + with: + path: ${{ matrix.platformio-path }} + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9.13" + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + - name: Copy of necessary files + run: | + cp platformio_orig.ini platformio.ini + cp src/loraconf_sample.h src/loraconf.h + cp src/ota_sample.conf src/ota.conf + cp src/paxcounter_orig.conf src/paxcounter.conf + - name: Clean + run: pio run -t clean -e ci + - name: Run PlatformIO CI for ${{ matrix.board }} + env: + CI_HALFILE: ${{ matrix.board }} + run: pio run -e ci + build-s3-usb-stick: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest, macos-latest] include: - os: ubuntu-latest path: ~/.cache/pip platformio-path: ~/.platformio + - os: macos-latest + path: ~/Library/Caches/pip + platformio-path: ~/Library/Caches/platformio + - os: windows-latest + path: ~\AppData\Local\pip\Cache + platformio-path: ~\AppData\Local\platformio\Cache board: [ttgotdongles3.h, ttgotdongledisplays3.h] runs-on: ${{ matrix.os }} From db63c14638dde1d6cfcc974b02efdb7afbf8c3ac Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Fri, 4 Nov 2022 18:51:37 +0100 Subject: [PATCH 14/16] update ttgotdongledisplays3.h --- src/hal/ttgotdongledisplays3.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/hal/ttgotdongledisplays3.h b/src/hal/ttgotdongledisplays3.h index e198275c..98def89a 100644 --- a/src/hal/ttgotdongledisplays3.h +++ b/src/hal/ttgotdongledisplays3.h @@ -2,21 +2,24 @@ // upload_speed 1500000 // board esp32-s3-devkitc-1 -// see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 +// for pinouts see https://github.com/Xinyuan-LilyGO/T-Dongle-S3 -#ifndef _TTGOTDONGLES3_H -#define _TTGOTDONGLES3_H +#ifndef _TTGOTDONGLEDISPLAYS3_H +#define _TTGOTDONGLEDISPLAYS3_H #include #define HAS_LED NOT_A_PIN -#define HAS_BUTTON 0 - -#define HAS_SDCARD 2 // this board has a SD MMC card-reader/writer -#define SDCARD_SLOTWIDTH 4 // 4-line interface +#define RGB_LED_COUNT 1 +#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT) +#define FASTLED_INTERNAL +#define HAS_BUTTON 0 // dongle button is on GPIO0 +#define HAS_SDCARD 2 // dongle has a SD MMC card-reader/writer +#define SDCARD_SLOTWIDTH 4 // dongle has 4 line interface +#define SDCARD_SLOTCONFIG { .clk = GPIO_NUM_12, .cmd = GPIO_NUM_16, .d0 = GPIO_NUM_14, .d1 = GPIO_NUM_17, .d2 = GPIO_NUM_21, .d3 = GPIO_NUM_18, .cd = SDMMC_SLOT_NO_CD, .wp = SDMMC_SLOT_NO_WP, .width = 4, .flags = 0, } #define HAS_DISPLAY 2 // TFT-LCD -#define TFT_TYPE DISPLAY_T_DISPLAY_S3 +#define TFT_TYPE DISPLAY_T_DISPLAY_S3 // may currently not work, we are awaiting a PR for display lib #define MY_DISPLAY_FLIP 1 // use if display is rotated #define MY_DISPLAY_WIDTH 80 #define MY_DISPLAY_HEIGHT 160 From ac895b91d5b9d63f7f9fcbc2d06e72f1411f9cf4 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 5 Nov 2022 16:08:46 +0100 Subject: [PATCH 15/16] update readme.md for v3.4.0 --- README.md | 11 ++++++----- platformio_orig.ini | 2 +- ...io_orig_s3-usb-stick.ini => platformio_orig_s3.ini | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) rename platformio_orig_s3-usb-stick.ini => platformio_orig_s3.ini (95%) diff --git a/README.md b/README.md index 00adb7e1..bcf4f367 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ You can build this project battery powered using ESP32 deep sleep mode and reach **Supported ESP32 based boards**: -*LoRa & SPI*: +*With LoRa radio data transfer*: - **LilyGo: [Paxcounter-Board*](https://www.aliexpress.com/item/32915894264.html?spm=a2g0o.productlist.0.0.3d656325QrcfQc&algo_pvid=4a150199-63e7-4d21-bdb1-b48164537744&algo_exp_id=4a150199-63e7-4d21-bdb1-b48164537744-2&pdp_ext_f=%7B%22sku_id%22%3A%2212000023374441919%22%7D)** - TTGO: T1*, T2*, T3*, T-Beam, T-Fox @@ -43,10 +43,9 @@ LoLin32lite + [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-L - Adafruit ESP32 Feather + LoRa Wing + OLED Wing, #IoT Octopus32 (Octopus + ESP32 Feather) - M5Stack: [Basic Core IoT*](https://m5stack.com/collections/m5-core/products/basic-core-iot-development-kit) + [Lora Module RA-01H](https://m5stack.com/collections/m5-module/products/lora-module-868mhz), [Fire IoT*](https://m5stack.com/collections/m5-core/products/fire-iot-development-kit) -*) supports microSD-card - -*SPI only*: +*Without LoRa*: +- LilyGo: [T-Dongle S3*](https://github.com/Xinyuan-LilyGO/T-Dongle-S3) - Pyom: WiPy - WeMos: LoLin32, LoLin32 Lite, WeMos D32, [Wemos32 Oled](https://www.instructables.com/id/ESP32-With-Integrated-OLED-WEMOSLolin-Getting-Star/) - Crowdsupply: [TinyPICO](https://www.crowdsupply.com/unexpected-maker/tinypico) @@ -54,6 +53,8 @@ LoLin32lite + [LoraNode32-Lite shield](https://github.com/hallard/LoLin32-Lite-L - TTGO: [T-Wristband](https://www.aliexpress.com/item/4000527495064.html) - Generic ESP32 +*) supports microSD/TF-card for local logging of paxcounter data + Depending on board hardware following features are supported: - LoRaWAN communication, supporting various payload formats (see enclosed .js converters) - MQTT communication via TCP/IP and Ethernet interface (note: payload transmitted over MQTT will be base64 encoded) @@ -95,7 +96,7 @@ Install PlatformIO IDE for embedded developmen Compile time configuration is spread across several files. Before compiling the code, edit or create the following files: ## platformio.ini -Edit `platformio_orig.ini` and select desired hardware target in section boards. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in sections board. Copy or rename to `platformio.ini` in the root directory of the project. Now start Platformio. Note: Platformio is looking for `platformio.ini` in the root directory and won't start if it does not find this file. +Edit `platformio_orig.ini` (for ESP32 CPU based boards) *or* `platformio_orig_s3.ini` (for ESP32-S3 CPU based boards) and select desired board in section **board**. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in section **board**. Copy or rename to `platformio.ini` in the root directory of the project. Now start Platformio. Note: Platformio is looking for `platformio.ini` in the root directory and won't start if it does not find this file! ## 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`. diff --git a/platformio_orig.ini b/platformio_orig.ini index 59cbb1c9..f291f52c 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.3.2 +release_version = 3.4.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 diff --git a/platformio_orig_s3-usb-stick.ini b/platformio_orig_s3.ini similarity index 95% rename from platformio_orig_s3-usb-stick.ini rename to platformio_orig_s3.ini index b51b27cc..c8bf4c65 100644 --- a/platformio_orig_s3-usb-stick.ini +++ b/platformio_orig_s3.ini @@ -1,6 +1,7 @@ [board] halfile = ttgotdongles3.h ;halfile = ttgotdongledisplays3.h +;halfile = ttgotdisplays3.h [platformio] ; upload firmware to board with usb cable @@ -9,10 +10,10 @@ 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.3.2 +release_version = 3.4.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 = 5 +debug_level = 3 extra_scripts = pre:build.py otakeyfile = ota.conf lorakeyfile = loraconf.h From 2956431e67430c4463f4138cd42fb1bd49380918 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 5 Nov 2022 16:18:16 +0100 Subject: [PATCH 16/16] bugfix in workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e89881..93712ca1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,7 +180,7 @@ jobs: pip install --upgrade platformio - name: Copy of necessary files run: | - cp platformio_orig_s3-usb-stick.ini platformio.ini + cp platformio_orig_s3.ini platformio.ini cp src/loraconf_sample.h src/loraconf.h cp src/ota_sample.conf src/ota.conf cp src/paxcounter_orig.conf src/paxcounter.conf