Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
d1e0bc75
Commit
d1e0bc75
authored
May 08, 2021
by
Eric Duminil
Browse files
Shorter example
parent
ab884503
Changes
2
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/save_config.h
View file @
d1e0bc75
...
...
@@ -28,69 +28,15 @@ enum ConfigShapeId {
Config_wifi_ssid
,
Config_wifi_password
,
Config_wifi_timeout
,
Config_measurement_timestep
,
Config_csv_interval
,
Config_temperature_offset
,
Config_altitude_above_sea_level
,
Config_atmospheric_co2_concentration
,
Config_auto_calibrate_sensor
,
Config_max_brightness
,
Config_min_brightness
,
Config_led_count
,
Config_http_user
,
Config_http_password
,
Config_mqtt_sending_interval
,
Config_mqtt_server
,
Config_mqtt_port
,
Config_mqtt_user
,
Config_mqtt_password
,
Config_ntp_server
,
Config_utc_offset_in_seconds
,
Config_bauds
,
};
static
constexpr
char
CFG_KEY_WIFI_SSID
[]
PROGMEM
=
"wifi_ssid"
;
static
constexpr
char
CFG_KEY_WIFI_PASSWORD
[]
PROGMEM
=
"wifi_password"
;
static
constexpr
char
CFG_KEY_WIFI_TIMEOUT
[]
PROGMEM
=
"wifi_timeout"
;
static
constexpr
char
CFG_KEY_MEASUREMENT_TIMESTEP
[]
PROGMEM
=
"measurement_timestep"
;
static
constexpr
char
CFG_KEY_CSV_INTERVAL
[]
PROGMEM
=
"csv_interval"
;
static
constexpr
char
CFG_KEY_TEMPERATURE_OFFSET
[]
PROGMEM
=
"temperature_offset"
;
static
constexpr
char
CFG_KEY_ALTITUDE_ABOVE_SEA_LEVEL
[]
PROGMEM
=
"altitude_above_sea_level"
;
static
constexpr
char
CFG_KEY_ATMOSPHERIC_CO2_CONCENTRATION
[]
PROGMEM
=
"atmospheric_co2_concentration"
;
static
constexpr
char
CFG_KEY_AUTO_CALIBRATE_SENSOR
[]
PROGMEM
=
"auto_calibrate_sensor"
;
static
constexpr
char
CFG_KEY_MAX_BRIGHTNESS
[]
PROGMEM
=
"max_brightness"
;
static
constexpr
char
CFG_KEY_MIN_BRIGHTNESS
[]
PROGMEM
=
"min_brightness"
;
static
constexpr
char
CFG_KEY_LED_COUNT
[]
PROGMEM
=
"led_count"
;
static
constexpr
char
CFG_KEY_HTTP_USER
[]
PROGMEM
=
"http_user"
;
static
constexpr
char
CFG_KEY_HTTP_PASSWORD
[]
PROGMEM
=
"http_password"
;
static
constexpr
char
CFG_KEY_MQTT_SENDING_INTERVAL
[]
PROGMEM
=
"mqtt_sending_interval"
;
static
constexpr
char
CFG_KEY_MQTT_SERVER
[]
PROGMEM
=
"mqtt_server"
;
static
constexpr
char
CFG_KEY_MQTT_PORT
[]
PROGMEM
=
"mqtt_port"
;
static
constexpr
char
CFG_KEY_MQTT_USER
[]
PROGMEM
=
"mqtt_user"
;
static
constexpr
char
CFG_KEY_MQTT_PASSWORD
[]
PROGMEM
=
"mqtt_password"
;
static
constexpr
char
CFG_KEY_NTP_SERVER
[]
PROGMEM
=
"ntp_server"
;
static
constexpr
char
CFG_KEY_UTC_OFFSET_IN_SECONDS
[]
PROGMEM
=
"utc_offset_in_seconds"
;
static
constexpr
char
CFG_KEY_BAUDS
[]
PROGMEM
=
"bauds"
;
static
constexpr
ConfigShapeEntry
configShape
[]
PROGMEM
=
{
{
Config_Type_String
,
sizeof
(
cfg
::
wifi_ssid
)
-
1
,
CFG_KEY_WIFI_SSID
,
cfg
::
wifi_ssid
},
{
Config_Type_Password
,
sizeof
(
cfg
::
wifi_password
)
-
1
,
CFG_KEY_WIFI_PASSWORD
,
cfg
::
wifi_password
},
{
Config_Type_UInt
,
0
,
CFG_KEY_WIFI_TIMEOUT
,
&
cfg
::
wifi_timeout
},
{
Config_Type_UInt
,
0
,
CFG_KEY_MEASUREMENT_TIMESTEP
,
&
cfg
::
measurement_timestep
},
{
Config_Type_UInt
,
0
,
CFG_KEY_CSV_INTERVAL
,
&
cfg
::
csv_interval
},
{
Config_Type_UInt
,
0
,
CFG_KEY_TEMPERATURE_OFFSET
,
&
cfg
::
temperature_offset
},
{
Config_Type_UInt
,
0
,
CFG_KEY_ALTITUDE_ABOVE_SEA_LEVEL
,
&
cfg
::
altitude_above_sea_level
},
{
Config_Type_UInt
,
0
,
CFG_KEY_ATMOSPHERIC_CO2_CONCENTRATION
,
&
cfg
::
atmospheric_co2_concentration
},
{
Config_Type_Bool
,
0
,
CFG_KEY_AUTO_CALIBRATE_SENSOR
,
&
cfg
::
auto_calibrate_sensor
},
{
Config_Type_UInt
,
0
,
CFG_KEY_MAX_BRIGHTNESS
,
&
cfg
::
max_brightness
},
{
Config_Type_UInt
,
0
,
CFG_KEY_MIN_BRIGHTNESS
,
&
cfg
::
min_brightness
},
{
Config_Type_UInt
,
0
,
CFG_KEY_LED_COUNT
,
&
cfg
::
led_count
},
{
Config_Type_String
,
sizeof
(
cfg
::
http_user
)
-
1
,
CFG_KEY_HTTP_USER
,
cfg
::
http_user
},
{
Config_Type_Password
,
sizeof
(
cfg
::
http_password
)
-
1
,
CFG_KEY_HTTP_PASSWORD
,
cfg
::
http_password
},
{
Config_Type_UInt
,
0
,
CFG_KEY_MQTT_SENDING_INTERVAL
,
&
cfg
::
mqtt_sending_interval
},
{
Config_Type_String
,
sizeof
(
cfg
::
mqtt_server
)
-
1
,
CFG_KEY_MQTT_SERVER
,
cfg
::
mqtt_server
},
{
Config_Type_UInt
,
0
,
CFG_KEY_MQTT_PORT
,
&
cfg
::
mqtt_port
},
{
Config_Type_String
,
sizeof
(
cfg
::
mqtt_user
)
-
1
,
CFG_KEY_MQTT_USER
,
cfg
::
mqtt_user
},
{
Config_Type_String
,
sizeof
(
cfg
::
mqtt_password
)
-
1
,
CFG_KEY_MQTT_PASSWORD
,
cfg
::
mqtt_password
},
{
Config_Type_String
,
sizeof
(
cfg
::
ntp_server
)
-
1
,
CFG_KEY_NTP_SERVER
,
cfg
::
ntp_server
},
{
Config_Type_UInt
,
0
,
CFG_KEY_UTC_OFFSET_IN_SECONDS
,
&
cfg
::
utc_offset_in_seconds
},
{
Config_Type_UInt
,
0
,
CFG_KEY_BAUDS
,
&
cfg
::
bauds
},
};
generate_ampel_config_h.py
View file @
d1e0bc75
...
...
@@ -6,25 +6,7 @@ configshape_in = """
String wifi_ssid
Password wifi_password
UInt wifi_timeout
UInt measurement_timestep
UInt csv_interval
UInt temperature_offset # Signed, actually. :-(
UInt altitude_above_sea_level
UInt atmospheric_co2_concentration
Bool auto_calibrate_sensor
UInt max_brightness
UInt min_brightness
UInt led_count
String http_user
Password http_password
UInt mqtt_sending_interval
String mqtt_server
UInt mqtt_port
String mqtt_user
String mqtt_password
String ntp_server
UInt utc_offset_in_seconds
UInt bauds # Too large for unsigned int
"""
with
open
(
"ampel-firmware/save_config.h"
,
"w"
)
as
h
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment