Browse Source

Merge pull request #211 from cubinet-code/config_override

Improve config system and make DTU_RADIO_ID customizable in config.h
pull/218/head^2
Andreas Schiffler 2 years ago
committed by GitHub
parent
commit
a24abc75dd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      tools/esp8266/.gitignore
  2. 4
      tools/esp8266/README.md
  3. 7
      tools/esp8266/config.h
  4. 30
      tools/esp8266/config_override_example.h
  5. 1
      tools/esp8266/hmRadio.h
  6. 4
      tools/esp8266/platformio.ini

1
tools/esp8266/.gitignore

@ -3,3 +3,4 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
config_override.h

4
tools/esp8266/README.md

@ -34,9 +34,11 @@ This code can be compiled using Visual Studio Code and **PlatformIO** Addon. The
### Optional Configuration before compilation
- number of supported inverters (set to 3 by default) `config.h`
- DTU radio id `hmRadio.h` (default = 1234567801
- DTU radio id `config.h` (default = 1234567801)
- unformated list in webbrowser `/livedata` `config.h`, `LIVEDATA_VISUALIZED`
Alternativly, instead of modifying `config.h`, `config_override_example.h` can be copied to `config_override.h` and customized.
config_override.h is excluded from version control and stays local.
## Flash ESP with firmware

7
tools/esp8266/config.h

@ -36,6 +36,9 @@
#define DEF_RF24_CE_PIN 2
#define DEF_RF24_IRQ_PIN 0
// default radio ID
#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL)
// default NRF24 power, possible values (0 - 3)
#define DEF_AMPLIFIERPOWER 2
@ -96,4 +99,8 @@
// changes the style of "/setup" page, visualized = nicer
#define LIVEDATA_VISUALIZED
#if __has_include("config_override.h")
#include "config_override.h"
#endif
#endif /*__CONFIG_H__*/

30
tools/esp8266/config_override_example.h

@ -0,0 +1,30 @@
//-----------------------------------------------------------------------------
// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//-----------------------------------------------------------------------------
#ifndef __CONFIG_OVERRIDE_H__
#define __CONFIG_OVERRIDE_H__
// override fallback WiFi info
// each ovveride must be preceeded with an #undef statement
#undef FB_WIFI_SSID
#define FB_WIFI_SSID "MY_SSID"
// each ovveride must be preceeded with an #undef statement
#undef FB_WIFI_PWD
#define FB_WIFI_PWD "MY_WIFI_KEY"
// ESP32 default pinout
#undef DEF_RF24_CS_PIN
#define DEF_RF24_CS_PIN 5
#undef DEF_RF24_CE_PIN
#define DEF_RF24_CE_PIN 4
#undef DEF_RF24_IRQ_PIN
#define DEF_RF24_IRQ_PIN 16
#undef DTU_RADIO_ID
#define DTU_RADIO_ID ((uint64_t)0x1234567802ULL)
#endif /*__CONFIG_OVERRIDE_H__*/

1
tools/esp8266/hmRadio.h

@ -16,7 +16,6 @@
#define DEFAULT_RECV_CHANNEL 3
#define SPI_SPEED 1000000
#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL)
#define DUMMY_RADIO_ID ((uint64_t)0xDEADBEEF01ULL)
#define RF_CHANNELS 5

4
tools/esp8266/platformio.ini

@ -14,9 +14,11 @@ src_dir = .
[env]
framework = arduino
build_flags =
-include "config.h"
; ;;;;; Possible Debug options ;;;;;;
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level
;build_flags = -DDEBUG_ESP_PORT=Serial
;-DDEBUG_ESP_PORT=Serial
;-DDEBUG_ESP_CORE
;-DDEBUG_ESP_WIFI
;-DDEBUG_ESP_HTTP_CLIENT

Loading…
Cancel
Save