From edb8d1a591524daa8f4bba4a74077cc356d15738 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 17 Dec 2022 04:38:13 +0100 Subject: [PATCH] Added Thingpulse ESP32 gateways (#1369) * added thingspulse gateways * added thingspulse gateways, RGB LED for tinypico * Added some LED and Birghtness options * Requested Changes * fixed format --- .github/workflows/build.yml | 2 ++ main/User_config.h | 40 +++++++++++++++-------- platformio.ini | 63 +++++++++++++++++++++++++++++++++++++ scripts/gen_wu.py | 2 +- scripts/gen_wu_dev.py | 2 +- 5 files changed, 94 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fa90a2..36cea3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,6 +71,8 @@ jobs: - "esp32dev-ble-datatest" - "esp32s3-dev-c1-ble" - "esp32c3-dev-m1-ble" + - "thingpulse-espgateway" + - "thingpulse-espgateway-ethernet" runs-on: ubuntu-latest name: Build with PlatformIO steps: diff --git a/main/User_config.h b/main/User_config.h index 1389722..d34bd1a 100644 --- a/main/User_config.h +++ b/main/User_config.h @@ -454,28 +454,42 @@ CRGB leds[FASTLED_IND_NUM_LEDS]; # ifndef RGB_LED_POWER # define RGB_LED_POWER -1 // If the RGB Led is linked to GPIO pin for power define it here # endif +# ifndef FASTLED_BRIGHTNESS +# define FASTLED_BRIGHTNESS 20 // Set Default RGB brightness to approx 10% (0-255 scale) +# endif +// Allow to set LED used (for example thingpulse gateway has 4 we use them independently) +# ifndef FASTLED_INFO_LED +# define FASTLED_INFO_LED 0 // First Led +# endif +# ifndef FASTLED_SEND_RECEIVCE_LED +# define FASTLED_SEND_RECEIVCE_LED 0 // First Led +# endif +# ifndef FASTLED_ERROR_LED +# define FASTLED_ERROR_LED 0 // First Led +# endif + # define SetupIndicators() \ pinMode(RGB_LED_POWER, OUTPUT); \ digitalWrite(RGB_LED_POWER, HIGH); \ FastLED.addLeds(leds, FASTLED_IND_NUM_LEDS); \ - FastLED.setBrightness(20); -# define ErrorIndicatorON() \ - leds[0] = CRGB::Orange; \ + FastLED.setBrightness(FASTLED_BRIGHTNESS); +# define ErrorIndicatorON() \ + leds[FASTLED_ERROR_LED] = CRGB::Orange; \ FastLED.show() -# define ErrorIndicatorOFF() \ - leds[0] = CRGB::Black; \ +# define ErrorIndicatorOFF() \ + leds[FASTLED_ERROR_LED] = CRGB::Black; \ FastLED.show() -# define SendReceiveIndicatorON() \ - leds[0] = CRGB::Blue; \ +# define SendReceiveIndicatorON() \ + leds[FASTLED_SEND_RECEIVCE_LED] = CRGB::Blue; \ FastLED.show() -# define SendReceiveIndicatorOFF() \ - leds[0] = CRGB::Black; \ +# define SendReceiveIndicatorOFF() \ + leds[FASTLED_SEND_RECEIVCE_LED] = CRGB::Black; \ FastLED.show() -# define InfoIndicatorON() \ - leds[0] = CRGB::Green; \ +# define InfoIndicatorON() \ + leds[FASTLED_INFO_LED] = CRGB::Green; \ FastLED.show() -# define InfoIndicatorOFF() \ - leds[0] = CRGB::Black; \ +# define InfoIndicatorOFF() \ + leds[FASTLED_INFO_LED] = CRGB::Black; \ FastLED.show() #endif diff --git a/platformio.ini b/platformio.ini index 358c392..7e30c1b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -890,6 +890,7 @@ build_flags = ${com-esp.build_flags} '-DZgatewayBT="BT"' '-DGateway_Name="OpenMQTTGateway_ESP32_TINYPICO_BLE"' + board_build.flash_mode = dio [env:ttgo-lora32-v1-868] @@ -1451,3 +1452,65 @@ build_flags = '-DFASTLED_IND_NUM_LEDS=1' '-DRGB_INDICATORS=true' '-DGateway_Name="OpenMQTTGateway_ESP32_BLE"' + +[env:thingpulse-espgateway] +platform = ${com.esp32_platform} +board = esp32dev +board_build.partitions = min_spiffs.csv +lib_deps = + ${com-esp.lib_deps} + ${libraries.wifimanager32} + ${libraries.ble} + ${libraries.fastled} + ${libraries.decoder} +build_flags = + ${com-esp.build_flags} + '-DZgatewayBT="BT"' + '-DLED_SEND_RECEIVE=2' + '-DLED_SEND_RECEIVE_ON=0' + '-DpubBLEServiceUUID=true' + '-DGateway_Name="OpenMQTTGateway_THINGPULSE_BLE"' + '-DFASTLED_IND_DATA_GPIO=32,GRB' + '-DFASTLED_IND_TYPE=WS2812' + '-DFASTLED_IND_NUM_LEDS=4' + '-DFASTLED_INFO_LED=0' + '-DFASTLED_SEND_RECEIVCE_LED=1' + '-DFASTLED_ERROR_LED=2' + '-DFASTLED_BRIGHTNESS=255' + '-DRGB_INDICATORS=true' +; '-DsimplePublishing=true' + + +[env:thingpulse-espgateway-ethernet] +platform = ${com.esp32_platform} +board = esp32dev +board_build.partitions = min_spiffs.csv +lib_deps = + ${com-esp.lib_deps} + ${libraries.wifimanager32} + ${libraries.ble} + ${libraries.fastled} + ${libraries.decoder} +build_flags = + ${com-esp.build_flags} + '-DZgatewayBT="BT"' + '-DLED_SEND_RECEIVE=2' + '-DLED_SEND_RECEIVE_ON=0' + '-DpubBLEServiceUUID=true' + '-DGateway_Name="OpenMQTTGateway_THINGPULSE_ETH_BLE"' + '-DESP32_ETHERNET=true' + '-DETH_PHY_TYPE=ETH_PHY_LAN8720' + '-DETH_PHY_ADDR=0' + '-DETH_PHY_POWER=5' + '-DETH_PHY_MDC=23' + '-DETH_PHY_MDIO=18' + '-DETH_CLK_MODE=ETH_CLOCK_GPIO16_OUT' + '-DFASTLED_IND_DATA_GPIO=32,GRB' + '-DFASTLED_IND_TYPE=WS2812' + '-DFASTLED_IND_NUM_LEDS=4' + '-DFASTLED_INFO_LED=0' + '-DFASTLED_SEND_RECEIVCE_LED=1' + '-DFASTLED_ERROR_LED=2' + '-DFASTLED_BRIGHTNESS=255' + '-DRGB_INDICATORS=true' +; '-DsimplePublishing=true' diff --git a/scripts/gen_wu.py b/scripts/gen_wu.py index 178f3e6..118b534 100644 --- a/scripts/gen_wu.py +++ b/scripts/gen_wu.py @@ -119,7 +119,7 @@ with open(manif_path + filename,'wb') as output_file: for item in range(len(assets)): name = assets[item]['name'] - if 'firmware.bin' in name and ('esp32' in name or 'ttgo' in name or 'heltec' in name): + if 'firmware.bin' in name and ('esp32' in name or 'ttgo' in name or 'heltec' in name or 'thingpulse' in name): fw = name.split('-firmware')[0] man_file = fw + '.manifest.json' fw_url = assets[item]['browser_download_url'] diff --git a/scripts/gen_wu_dev.py b/scripts/gen_wu_dev.py index bc9951a..7125aa6 100644 --- a/scripts/gen_wu_dev.py +++ b/scripts/gen_wu_dev.py @@ -107,7 +107,7 @@ with open(manif_path + filename,'wb') as output_file: output_file.write(boot_bin.content) for name in os.listdir(bin_path): - if 'firmware.bin' in name and ('esp32' in name or 'ttgo' in name or 'heltec' in name): + if 'firmware.bin' in name and ('esp32' in name or 'ttgo' in name or 'heltec' in name or 'thingpulse' in name): fw = name.split('-firmware')[0] man_file = fw + '.manifest.json' print('Bin name:' + name)