39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
#!/usr/bin/python
|
|
|
|
from Cheetah.Template import Template
|
|
|
|
|
|
|
|
|
|
configItems = [
|
|
{"label":"_", "key":"magic", "type":"I", "default": ""},
|
|
{"label":"Config Username", "key":"confUser", "type":"C", "length":16, "default":"admin"},
|
|
{"label":"Config Password", "key":"confPasswd", "type":"C", "length":16, "default":"geheim123"},
|
|
{"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32, "default":"test"},
|
|
{"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64, "default":"geheim"},
|
|
{"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":32, "default":"broker.hottis.de"},
|
|
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"TwoLedSignal1"},
|
|
{"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":1883},
|
|
{"label":"MQTT Topic LED 1", "key":"mqttTopicLed1", "type":"C", "length":64, "default":"IoT/TwoLedSignal1/Led1"},
|
|
{"label":"MQTT Topic LED 2", "key":"mqttTopicLed2", "type":"C", "length":64, "default":"IoT/TwoLedSignal1/Led2"},
|
|
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/TwoLedSignal1/Debug"},
|
|
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
|
|
]
|
|
|
|
|
|
magic = 0xC0DE0004
|
|
appName = "ESP8266 based TwoLedSignal"
|
|
confWifiSsid = "espconfig"
|
|
|
|
params = {
|
|
"magic":magic,
|
|
"appName":appName,
|
|
"confWifiSsid":confWifiSsid,
|
|
"configItems":configItems
|
|
}
|
|
|
|
h_file = Template(file="configuration_h.tmpl", searchList=[params])
|
|
open('configuration.h','w').write(str(h_file))
|
|
c_file = Template(file="configuration_c.tmpl", searchList=[params])
|
|
open('configuration.cpp','w').write(str(c_file))
|