ConfigGenerator stuff

This commit is contained in:
2019-04-25 15:55:19 +02:00
parent e3a2edd94d
commit 04245e112c
5 changed files with 239 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#!/usr/bin/python
from Cheetah.Template import Template
from ConfigDataStructure import configItems
#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 Username", "key":"mqttUser", "type":"C", "length":32, "default":"RgbLed1"},
# {"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim123"},
# {"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"RgbLed1"},
# {"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883},
# {"label":"MQTT Topic Color Command", "key":"mqttTopicColorCommand", "type":"C", "length":64, "default":"IoT/RgbLed1/ColorCommand"},
# {"label":"MQTT Topic Command", "key":"mqttTopicCommand", "type":"C", "length":64, "default":"IoT/RgbLed1/Command"},
# {"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
# {"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
#]
magic = 0xC0DE0005
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))