Skip to content

Commit

Permalink
add config version check to main
Browse files Browse the repository at this point in the history
  • Loading branch information
lebaston100 committed Jan 12, 2024
1 parent 45f9a9b commit 4175333
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
15 changes: 15 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
from PyQt6.QtWidgets import QApplication

import utils
from modules import config
from ui import MainWindow

logger = utils.LoggerClass.getRootLogger()

REQUIRED_CONFIG_VERSION = 1


def checkConfigVersion() -> bool:
logger.debug("Checking config version")
configVersion = config.get("configVersion", 0)
if configVersion < REQUIRED_CONFIG_VERSION:
logger.info("Config needs upgrade")
else:
logger.info("Config version is ok")
return True


if __name__ == "__main__":
logger.info("Starting vrc-patpatpat V0.1")
checkConfigVersion()
app = QApplication(sys.argv)

window = MainWindow()
Expand Down
45 changes: 28 additions & 17 deletions server/prototype-config.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"configVersion": 1,
"program": {
"vrcOscPort": 9000,
"mqttBrokerIp": "10.2.1.11",
"mainTps": 41,
"logLevel": "DEBUG",
"testarray": [
41,
41,
33
]
"logLevel": "DEBUG"
},
"esps": {
"esp0": {
Expand All @@ -26,15 +22,30 @@
{
"name": "Motor 1",
"espAddr": [
1,
0,
1
],
"minPwm": 75,
"minPwm": 70,
"maxPwm": 255,
"xyz": [
1.0,
2.0,
3.0
1.0001,
2.0001,
3.02
],
"r": 0.5
},
{
"name": "Motor 2",
"espAddr": [
0,
2
],
"minPwm": 70,
"maxPwm": 255,
"xyz": [
1.0001,
2.0001,
3.02
],
"r": 0.5
}
Expand All @@ -45,20 +56,20 @@
"receiverId": "rec_1",
"xyz": [
1.0,
2.0,
3.0
2.0001,
3.002
],
"r": 0.5
},
{
"name": "Point 2",
"receiverId": "rec_2",
"xyz": [
6.0,
44.0,
8.0
5.2201,
18.0001,
8.0001
],
"r": 0.5
"r": 0.5001
}
],
"solver": {
Expand Down

0 comments on commit 4175333

Please sign in to comment.