Skip to content

Commit 451fc79

Browse files
committed
250505.3
1 parent 04785b3 commit 451fc79

File tree

4 files changed

+125
-17
lines changed

4 files changed

+125
-17
lines changed

config.ecs

Lines changed: 124 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
label Label
1919
label RelayStateLabel
2020
label StatusLabel
21+
label UptimeLabel
2122
pushbutton ResetConfigButton
23+
pushbutton RBRNowDirectoryButton
2224
pushbutton ScanDevicesButton
2325
pushbutton ClearSystemButton
2426
pushbutton RemoveSlaveButton
@@ -63,6 +65,10 @@
6365
on click ResetConfigButton go to ResetConfigFileClick
6466
add ResetConfigButton to LeftPanel
6567

68+
create RBRNowDirectoryButton text `Get the RBR-Now directory`
69+
on click RBRNowDirectoryButton go to RBRNowDirectoryClick
70+
add RBRNowDirectoryButton to LeftPanel
71+
6672
create ClearSystemButton text `Clear the selected system`
6773
on click ClearSystemButton go to ClearSystemClick
6874
add ClearSystemButton to LeftPanel
@@ -151,6 +157,12 @@
151157
add Label to Layout
152158
create DeviceNameInput size 40
153159
add DeviceNameInput to Layout
160+
create Label text `Uptime:`
161+
add Label to Layout
162+
create UptimeLabel text `0`
163+
add UptimeLabel to Layout
164+
create Label text `sec`
165+
add Label to Layout
154166
add stretch to Layout
155167

156168
create Layout type QHBoxLayout
@@ -273,6 +285,7 @@
273285
variable Files
274286
variable Count
275287
variable Content
288+
variable Uptime
276289
variable APInfo
277290
variable Info
278291
variable Keys
@@ -302,6 +315,10 @@ Start:
302315
if Config does not have property `current-system` set property `current-system` of Config to empty
303316
put property `hosts` of Config into Hosts
304317

318+
put empty into SystemHostSSID
319+
put empty into SystemIPAddr
320+
clear DeviceSelected
321+
305322
! Get the host SSID
306323
put `Getting host SSID...` into StatusMessage
307324
gosub to Working
@@ -320,6 +337,8 @@ Start:
320337
put `Connected to ` cat HostSSID into StatusMessage
321338
gosub to Idle
322339

340+
gosub to CheckFirmware
341+
323342
! Get the list of systems from Config, or create an empty list. Then populate the combo box
324343
if Config has property `systems` put property `systems` of Config into Systems
325344
else
@@ -329,12 +348,6 @@ Start:
329348
end
330349
gosub to RefreshSystemsCombo
331350

332-
put empty into SystemHostSSID
333-
put empty into SystemIPAddr
334-
clear DeviceSelected
335-
put trim system `echo $HOME` into FirmwareDirectory
336-
put FirmwareDirectory cat `/dev/rbr/roombyroom/Controller/home/orangepi/firmware/NOW/` into FirmwareDirectory
337-
338351
! Select the current system
339352
if the count of SystemsCombo is 0 put empty into SystemName
340353
else
@@ -551,6 +564,42 @@ ClearSystemClick:
551564
gosub to OK
552565
stop
553566

567+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
568+
! Get the RBR-Now directory and save it.
569+
RBRNowDirectoryClick:
570+
gosub to GetFirmware
571+
gosub to CheckFirmware3
572+
stop
573+
574+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
575+
! Check if we have a valid firmware directory.
576+
CheckFirmware:
577+
if Config has property `firmware` put property `firmware` of Config into FirmwareDirectory
578+
else put empty into FirmwareDirectory
579+
CheckFirmware2:
580+
if file FirmwareDirectory cat `/files.txt` exists
581+
begin
582+
set property `firmware` of Config to FirmwareDirectory
583+
save prettify Config to ConfigFile
584+
go to OK
585+
end
586+
put `Firmware directory is missing` into StatusMessage
587+
gosub to Error
588+
gosub to GetFirmware
589+
CheckFirmware3:
590+
if ReturnValue is empty return
591+
put trim system `echo $HOME` cat `/` cat ReturnValue into FirmwareDirectory
592+
go to CheckFirmware2
593+
594+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
595+
! Get the RBR-Now firmware
596+
GetFirmware:
597+
put `RBR-Now firmware` into Title
598+
put `Get the directory containing the RBR-Now firmware`
599+
cat newline cat `(relative to your home directory)` into Prompt
600+
put 80 into Length
601+
go to GetRequestedText
602+
554603
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
555604
! Scan the local network for new devices
556605
ScanForDevicesClick:
@@ -868,7 +917,8 @@ PopulateSystemInfo:
868917
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
869918
! Update text on MasterDeviceButton
870919
SetMasterDeviceButtonText:
871-
set the text of MasterDeviceButton to MasterSSID cat ` ` cat MasterIPAddr cat ` ` cat MasterDeviceName
920+
! set the text of MasterDeviceButton to MasterSSID cat ` ` cat MasterIPAddr cat ` ` cat MasterDeviceName
921+
set the text of MasterDeviceButton to MasterSSID cat ` ` cat MasterDeviceName
872922
return
873923

874924
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -893,7 +943,10 @@ PopulateDeviceInfo:
893943
if Device has property `name`
894944
begin
895945
log `Populate device ` cat property `name` of Device
946+
gosub to CheckDevice
896947
set the text of DeviceNameInput to property `name` of Device
948+
set the text of UptimeLabel to Uptime
949+
set the text of RelayStateLabel to `???`
897950
set the text of PathInput to property `path` of Device
898951
put property `pins` of Device into Pins
899952
put property `led` of Pins into Pin
@@ -970,6 +1023,7 @@ GetHostPassword:
9701023
log `Get the host password`
9711024
put `Type the host password:` into Prompt
9721025
put `Host password` into Title
1026+
put 40 into Length
9731027
gosub to GetRequestedText
9741028
put ReturnValue into HostPassword
9751029
return
@@ -982,7 +1036,7 @@ GetRequestedText:
9821036
add Label to VLayout
9831037
create HLayout type QHBoxLayout
9841038
add HLayout to VLayout
985-
create LineInput size 40
1039+
create LineInput size Length
9861040
add stretch LineInput to HLayout
9871041
create HLayout type QHBoxLayout
9881042
add HLayout to VLayout
@@ -1134,14 +1188,6 @@ UpdateWidgetDataClick:
11341188
gosub to ManageButtonStates
11351189
stop
11361190

1137-
RelayOffClick:
1138-
log `Turn the relay OFF`
1139-
stop
1140-
1141-
RelayOnClick:
1142-
log `Turn the relay ON`
1143-
stop
1144-
11451191
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11461192
! Update all the files on a device
11471193
UpdateFilesClick:
@@ -1262,6 +1308,7 @@ SendFileFail:
12621308
DeleteFileClick:
12631309
put `Name of file to delete:` into Prompt
12641310
put `Delete file` into Title
1311+
put 40 into Length
12651312
gosub to GetRequestedText
12661313
if ReturnValue is not empty
12671314
begin
@@ -1299,6 +1346,67 @@ RequestReset:
12991346
put `Device ` cat Name cat ` has been reset` into StatusMessage
13001347
go to Working
13011348

1349+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1350+
! Check a device
1351+
CheckDevice:
1352+
put `uptime` into Message
1353+
gosub to SendRBRMessage
1354+
if Response is empty
1355+
begin
1356+
put `No response from ` cat Name into StatusMessage
1357+
gosub to Error
1358+
put 0 into Uptime
1359+
end
1360+
else put from 3 of Response into Uptime
1361+
1362+
CheckDevice2:
1363+
put the position of ` ` in Uptime into P
1364+
put left P of Uptime into Uptime
1365+
log Name cat ` uptime: ` cat Uptime
1366+
set the text of UptimeLabel to Uptime
1367+
return
1368+
1369+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1370+
! Turn a relay OFF
1371+
RelayOffClick:
1372+
log `Turn the relay OFF`
1373+
put `off` into Message
1374+
gosub to SendRBRMessage
1375+
log `ON: ` cat Response
1376+
if Response is empty
1377+
begin
1378+
put `No response from ` cat Name into StatusMessage
1379+
gosub to Error
1380+
put 0 into Uptime
1381+
end
1382+
begin
1383+
put from 3 of Response into Uptime
1384+
set the text of RelayStateLabel to `OFF`
1385+
end
1386+
gosub to CheckDevice2
1387+
stop
1388+
1389+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1390+
! Turn a relay ON
1391+
RelayOnClick:
1392+
log `Turn the relay ON`
1393+
put `on` into Message
1394+
gosub to SendRBRMessage
1395+
log `ON: ` cat Response
1396+
if Response is empty
1397+
begin
1398+
put `No response from ` cat Name into StatusMessage
1399+
gosub to Error
1400+
put 0 into Uptime
1401+
end
1402+
else
1403+
begin
1404+
put from 3 of Response into Uptime
1405+
set the text of RelayStateLabel to `ON`
1406+
end
1407+
gosub to CheckDevice2
1408+
stop
1409+
13021410
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13031411
! Send an RBR-Now message to a device
13041412
SendRBRMessage:
Binary file not shown.

easycoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
from .ec_timestamp import *
1010
from .ec_value import *
1111

12-
__version__ = "250505.2"
12+
__version__ = "250505.3"

0 commit comments

Comments
 (0)