Index: shared/scripts/denaliMessages.py =================================================================== diff -u -r34ec092c464500431f428cadea93696885cc15e0 -r40568c277aa2c01963d0f3f9da41748c2686d343 --- shared/scripts/denaliMessages.py (.../denaliMessages.py) (revision 34ec092c464500431f428cadea93696885cc15e0) +++ shared/scripts/denaliMessages.py (.../denaliMessages.py) (revision 40568c277aa2c01963d0f3f9da41748c2686d343) @@ -61,9 +61,10 @@ def show_PowerOffRejectionDialog(): subprocess.call(['cansend', 'can0', '020#A5.01.00.01.00.01.02.5A']) -# This message needs to be acknowledged by seq# 01.00 : just call send_acknowledge_UI after this +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildSetTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate): - msg = messageBuilder.buildMessage( 5, 4 * 7, + msg = messageBuilder.buildMessage( GuiActionType.TreatmentRanges, 4 * 6, utils.toU32(vMinTreatmentDuration), utils.toU32(vMaxTreatmentDuration), utils.toU32(vMinUFVolume ), @@ -72,13 +73,16 @@ utils.toU32(vMaxDialysateFlowRate) ) return messageBuilder.toFrames(msg) - -def setTreatmentParamRanges(): # ---------------vvvvv---------------- - subprocess.call(['cansend', 'can0', '040#A5.FF.FF.1A.00.18.02.00']) - subprocess.call(['cansend', 'can0', '040#00.00.E0.01.00.00.00.00']) - subprocess.call(['cansend', 'can0', '040#00.00.9A.09.00.00.96.00']) - subprocess.call(['cansend', 'can0', '040#00.00.26.02.00.00.C6.00']) +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def setTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate): + # This message needs to be acknowledged by seq# 01.00 : just call send_acknowledge_UI after this + # ------------------------------------------vvvvv----------------------------------------------- + frames = buildSetTreatmentParamRanges(vMinTreatmentDuration, vMaxTreatmentDuration, vMinUFVolume, vMaxUFVolume, vMinDialysateFlowRate, vMaxDialysateFlowRate) + frames = messageBuilder.toCandumpFormat(frames) + for frame in frames: + subprocess.call(['cansend', 'can0', '020#{}'.format(frame)]) + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildSetTreatmentBloodFlowRate(vFlowSetPt, vMeasFlow = 0, vRotSpd = 0, vMotSpd = 0, vMCSpd = 0, vMCCurr = 0, vPWM = 0): @@ -139,6 +143,22 @@ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def buildTreatmentTime(vSecsTotal, vSecsElap, vSecsRem): + msg = messageBuilder.buildMessage( GuiActionType.TreatmentTime, 3 * 4, + utils.toU32(vSecsTotal ), + utils.toU32(vSecsElap ), + utils.toU32(vSecsRem ) + ) + return messageBuilder.toFrames(msg) +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def setTreatmentTime(vSecsTotal, vSecsElap, vSecsRem): + frames = buildTreatmentTime(vSecsTotal, vSecsElap, vSecsRem) + frames = messageBuilder.toCandumpFormat(frames) + for frame in frames: + subprocess.call(['cansend', 'can0', '040#{}'.format(frame)]) + +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def buildAlarm(vState, vTop, vEsclatesIn, vSilentExpires, vFlags): msg = messageBuilder.buildMessage( GuiActionType.AlarmStatus, 4 * 4 + 2, utils.toU32(vState ), @@ -155,4 +175,3 @@ for frame in frames: subprocess.call(['cansend', 'can0', '001#{}'.format(frame)]) -