Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Script/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
CONFIG_YAML_FILE = os.path.join(BASE_PATH, "config.yaml")
RT_DB_FILE = os.path.join(BASE_PATH, "rtDb.json")

INPUT = 0
OUTPUT = 1
INPUT = False
OUTPUT = True

PULL_UP = 0
PULL_DOWN = 1
PULL_UP = False
PULL_DOWN = True

HIGH = 1
LOW = 0
HIGH = True
LOW = False

LCD_MODULE_NO_OF_ROW = 4
LCD_MODULE_NO_OF_COLUMN = 20
Expand Down
2 changes: 1 addition & 1 deletion Script/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def printCountValue(row: int, currentCount: int, totalCount: int):


# Turn on only the position LED
def showPositionLED(position: int):
def showPositionLED(position: int|None):
if position == POSITION_LEFT:
gpio.digitalWrite(POSITION_RIGHT_LED_PIN, LOW)
gpio.digitalWrite(POSITION_MIDDLE_LED_PIN, LOW)
Expand Down
2 changes: 1 addition & 1 deletion Script/rpigpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def deinit(self):
GPIO.cleanup()


def pinMode(self, pin: int, state: bool, pullUpDown: bool = None):
def pinMode(self, pin: int, state: bool, pullUpDown: bool|None = None):
_state = None
_pullUpDown = None

Expand Down
53 changes: 33 additions & 20 deletions Script/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def setYamlData(yamlFile, data):

def getAppVersion():
configData = getYamlData(CONFIG_YAML_FILE)
return configData.get("appVersion")
if configData:
return configData.get("appVersion")
else:
return "0.0.0.0000"


def createRtDbFile():
Expand All @@ -41,42 +44,52 @@ def createRtDbFile():

def getCycleCount():
rtData = getYamlData(RT_DB_FILE)
cycleCount = rtData.get("cycleCount")
if cycleCount == None:
cycleCount = 0
if rtData:
cycleCount = rtData.get("cycleCount")
if cycleCount == None:
cycleCount = 0

return int(cycleCount)
return int(cycleCount)
else:
return 0


def getTotalCount():
rtData = getYamlData(RT_DB_FILE)
totalCount = rtData.get("maxCount")
if totalCount == None:
configData = getYamlData(CONFIG_YAML_FILE)
totalCount = configData.get("maxCount")
if rtData:
totalCount = rtData.get("maxCount")
if totalCount == None:
configData = getYamlData(CONFIG_YAML_FILE)
if configData:
totalCount = configData.get("maxCount")

if totalCount == None:
totalCount = 0
if totalCount == None:
totalCount = 0

return int(totalCount)
return int(totalCount)
return 0


def setCycleCount(count: int):
rtData = getYamlData(RT_DB_FILE)
rtData["cycleCount"] = count
setYamlData(RT_DB_FILE, rtData)
if rtData:
rtData["cycleCount"] = count
setYamlData(RT_DB_FILE, rtData)


def getConfigUpdateStatus():
rtData = getYamlData(RT_DB_FILE)
updateNeeded = rtData.get("updateNeeded")
if updateNeeded == None:
updateNeeded = NO_CONFIG_UPDATE
if rtData:
updateNeeded = rtData.get("updateNeeded")
if updateNeeded == None:
updateNeeded = NO_CONFIG_UPDATE

return int(updateNeeded)
return int(updateNeeded)
return 0


def setConfigUpdateStatus(status):
rtData = getYamlData(RT_DB_FILE)
rtData["updateNeeded"] = status
setYamlData(RT_DB_FILE, rtData)
if rtData:
rtData["updateNeeded"] = status
setYamlData(RT_DB_FILE, rtData)
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
appVersion: 1.7.1.1011
appVersion: 1.7.2.1012
maxCount : 7500000