mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-01 03:06:21 +02:00
- Improve config system allowing a user customizable config_override.h file to ensure git pulls don't require merges
- Move DTU_RADIO_ID to config.h to allow for easy customization for multiple DTUs with non conflicting radio IDs
This commit is contained in:
parent
348ad4bd07
commit
7fc57ffc8c
6 changed files with 45 additions and 4 deletions
1
tools/esp8266/.gitignore
vendored
1
tools/esp8266/.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/ipch
|
.vscode/ipch
|
||||||
|
config_override.h
|
||||||
|
|
|
@ -20,10 +20,12 @@ This code can be compiled using Visual Studio Code and **PlatformIO** Addon. The
|
||||||
|
|
||||||
### Optional Configuration before compilation
|
### Optional Configuration before compilation
|
||||||
|
|
||||||
- number of supported inverters (set to 3 by default) `defines.h`
|
- number of supported inverters (set to 3 by default) `config.h`
|
||||||
- DTU radio id `hmRadio.h`
|
- DTU radio id `config.h` (default = 1234567801)
|
||||||
- unformated list in webbrowser `/livedata` `config.h`, `LIVEDATA_VISUALIZED`
|
- 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
|
## Flash ESP with firmware
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#define DEF_RF24_CE_PIN 2
|
#define DEF_RF24_CE_PIN 2
|
||||||
#define DEF_RF24_IRQ_PIN 0
|
#define DEF_RF24_IRQ_PIN 0
|
||||||
|
|
||||||
|
// default radio ID
|
||||||
|
#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL)
|
||||||
|
|
||||||
// default NRF24 power, possible values (0 - 3)
|
// default NRF24 power, possible values (0 - 3)
|
||||||
#define DEF_AMPLIFIERPOWER 2
|
#define DEF_AMPLIFIERPOWER 2
|
||||||
|
|
||||||
|
@ -96,4 +99,8 @@
|
||||||
// changes the style of "/setup" page, visualized = nicer
|
// changes the style of "/setup" page, visualized = nicer
|
||||||
#define LIVEDATA_VISUALIZED
|
#define LIVEDATA_VISUALIZED
|
||||||
|
|
||||||
|
#if __has_include("config_override.h")
|
||||||
|
#include "config_override.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /*__CONFIG_H__*/
|
#endif /*__CONFIG_H__*/
|
||||||
|
|
30
tools/esp8266/config_override_example.h
Normal file
30
tools/esp8266/config_override_example.h
Normal file
|
@ -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__*/
|
|
@ -16,7 +16,6 @@
|
||||||
#define DEFAULT_RECV_CHANNEL 3
|
#define DEFAULT_RECV_CHANNEL 3
|
||||||
#define SPI_SPEED 1000000
|
#define SPI_SPEED 1000000
|
||||||
|
|
||||||
#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL)
|
|
||||||
#define DUMMY_RADIO_ID ((uint64_t)0xDEADBEEF01ULL)
|
#define DUMMY_RADIO_ID ((uint64_t)0xDEADBEEF01ULL)
|
||||||
|
|
||||||
#define RF_CHANNELS 5
|
#define RF_CHANNELS 5
|
||||||
|
|
|
@ -14,9 +14,11 @@ src_dir = .
|
||||||
[env]
|
[env]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-include "config.h"
|
||||||
; ;;;;; Possible Debug options ;;;;;;
|
; ;;;;; Possible Debug options ;;;;;;
|
||||||
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level
|
; 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_CORE
|
||||||
;-DDEBUG_ESP_WIFI
|
;-DDEBUG_ESP_WIFI
|
||||||
;-DDEBUG_ESP_HTTP_CLIENT
|
;-DDEBUG_ESP_HTTP_CLIENT
|
||||||
|
|
Loading…
Add table
Reference in a new issue