config: error handling and adding windows interface name to template

This commit is contained in:
uhi22 2023-05-26 09:11:19 +02:00
parent 6c5c2b6af6
commit 2f68d6a76f
2 changed files with 15 additions and 4 deletions

View file

@ -12,14 +12,21 @@ def getConfigValue(s):
try:
return config['general'][s]
except:
print("Error: seems we have a problem with pyPlc.ini.")
print("Error: seems we have a problem with pyPlc.ini, with entry " + s)
print("How to fix: Try to use the docs/pyPlc.ini.template,")
print(" copy it into the pyPlc's main folder,")
print(" rename it to pyPlc.ini, and edit it for your needs.")
sys.exit()
def getConfigValueBool(s):
return config.getboolean('general', s)
try:
return config.getboolean('general', s)
except:
print("Error: seems we have a problem with pyPlc.ini, with entry " + s)
print("How to fix: Try to use the docs/pyPlc.ini.template,")
print(" copy it into the pyPlc's main folder,")
print(" rename it to pyPlc.ini, and edit it for your needs.")
sys.exit()
if __name__ == "__main__":
print("Testing configmodule...")

View file

@ -12,9 +12,13 @@ mode = PevMode
is_simulation_without_modems = false
# The Ethernet interface. Usually eth0 on Raspberry.
# Todo: This setting is considered only on linux. Find a clean solution for windows is to be done.
# This setting is considered only on linux.
eth_interface = eth0
# The Ethernet interface name on Windows. Something like
# \Device\NPF_{E4B8176C-8516-4D48-88BC-85225ABCF259}
eth_windows_interface_name = \Device\NPF_{E4B8176C-8516-4D48-88BC-85225ABCF259}
# If a display is connected via serial line, e.g. an WIFI-KIT-32 running the software from https://github.com/uhi22/SerialToOLED
display_via_serial = yes
@ -97,4 +101,4 @@ udp_syslog_enable = Yes
# REST callback for SoC states. Comment out to disable. Do not leave a trailing slash
soc_callback_enabled = False
soc_callback_endpoint = http://1.1.1.1
soc_callback_endpoint = http://1.1.1.1