mon petit projet se finalise (ecran nextion)
j'en suis a la partie nettoyage du code :
j'ai 1 page par piece et 4 pieces avec 4 thermostats
j'ai donc ceci pour 1 piece et que j'ai du dupliquer 4x en changeant uniquement les variables
étant nul en programmation orienté objet y'a t'il un programme pour pourrait raccourcir ceci ?
Code : Tout sélectionner
//chambres
on nextion#idx=1270 do
TaskValueSet 5,2,([Thermostat#chambres]+0.5)
if [Thermostat#chambres]>25
TaskValueSet 5,2,25
endif
TaskRun,5
endon
on nextion#idx=1271 do
TaskValueSet 5,2,([Thermostat#chambres]-0.5)
if [Thermostat#chambres]<15
TaskValueSet 5,2,15
endif
TaskRun,5
endon
on nextion#idx=1272 do
if [regul#chambres]=30
TaskValueSet 6,2,20
else
if [regul#chambres]=20
TaskValueSet 6,2,30
endif
endif
SendToHTTP,192.168.1.118,8080,/json.htm?type=command¶m=switchlight&idx=522&switchcmd=Set%20Level&level=[regul#chambres]
endon
on Thermostat#chambres do
nextion,Chambres.cons.txt="[Thermostat#chambres]"
SendToHTTP,192.168.1.118,8080,/json.htm?type=command¶m=udevice&idx=520&nvalue=0&svalue=[Thermostat#chambres]
endon