Skip to content

Commit 7a3cef8

Browse files
adapted on new raspi4 hardware
1 parent 81553e5 commit 7a3cef8

21 files changed

+17515
-10
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.save
2+
stm32flash

PySimpleGUI_save.py

+17,475
Large diffs are not rendered by default.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# UPS-2_Raspberry_SW
2+
23
Description coming soon

Schedule.csv

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Day [1 … 7],From [hh:mm:ss],To [hh:mm:ss],Retry[min],Job
2+
0,13:00,14:59,8,0:HP_CHECK_ACTIVATION
3+
0,17:00,17:30,0,1:HP_RESET
4+
0,18:00,18:59,9,2:HP_GET_FORECAST
5+
0,00:00,23:59,10,3:HP_LOG

UPS-2_G030.bak

0 Bytes
Binary file not shown.
807 KB
Binary file not shown.
807 KB
Binary file not shown.
1.15 KB
Binary file not shown.
1.16 KB
Binary file not shown.
1.03 KB
Binary file not shown.
2.92 KB
Binary file not shown.
2.92 KB
Binary file not shown.
824 Bytes
Binary file not shown.
832 Bytes
Binary file not shown.

stm32flash

100755100644
File mode changed.

ups2_FW_Upd_GUI.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
''' Select binary firmware file and update via bootloader. '''
77

8-
def GetUpdDialog():
8+
def GetUpdDialog(win_location = (50,50)):
99
initPath =os.path.dirname(os.path.realpath(__file__))
1010

1111
success = False
@@ -16,11 +16,9 @@ def GetUpdDialog():
1616
sg.FileBrowse(button_text = '...' , initial_folder = initPath, file_types=(("UPS-2 Firmware", "*.bin"),))],
1717
[sg.Button('Update', key = '_btn_upd_', disabled = True), sg.Button('Cancel')]]
1818

19-
window = sg.Window('Select UPS-2 Firmware Update',layout)
19+
window = sg.Window('Select UPS-2 Firmware Update',layout, location = win_location)
2020
while True:
2121
event, values = window.Read(timeout=200)
22-
if(values['_file_'] != ''):
23-
window['_btn_upd_'].update(disabled = False)
2422

2523
if event in (None, 'Cancel'):
2624
window.close()
@@ -33,6 +31,10 @@ def GetUpdDialog():
3331
window.close()
3432
return newFile
3533

34+
#enable update button if file selected
35+
if(values['_file_'] != ''):
36+
window['_btn_upd_'].update(disabled = False)
37+
3638
if __name__ == "__main__":
3739
newFile = GetUpdDialog()
3840
print(newFile)

ups2_Firmware_about.txt

Whitespace-only changes.

ups2_GUI.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Window]
2+
position_xy = (438, 362)
3+

ups2_GUI.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def ecFormatDisplay(sysStatus, window):
147147
# window['Power OFF'].SetTooltip('')
148148
#############################################################################
149149
config = cp.ConfigParser()
150-
config.read('ups_GUI.ini')
150+
config.read('ups2_GUI.ini')
151151
if(config.has_option('Window', 'position_xy')):
152152
win_location = config['Window']['position_xy']
153153
else:
@@ -192,7 +192,17 @@ def ecFormatDisplay(sysStatus, window):
192192
print('UPS Status', ups2Values)
193193
analogStr = ups.ecFormatAnalog(ups2Values[1])
194194

195-
#titlebar = sg.Titlebar(title = 'hello')
195+
str_about_FW = 'UPS-2 Hat Firmware Version: ' + ups2Version + \
196+
'\nCopyright 2021 Klaus Mezger' \
197+
'\nOpen Source BSD 2-Clause License' + \
198+
'\nhttps://choosealicense.com/licenses/bsd-2-clause'
199+
str_about_GUI = 'UPS-2 GUI Version: ' + GUI_Version + \
200+
'\nCopyright 2021 Klaus Mezger' \
201+
'\nOpen Source BSD 2-Clause License' + \
202+
'\nhttps://choosealicense.com/licenses/bsd-2-clause' + \
203+
'\n\nUsing PySimpleGUI' + \
204+
'https://pysimplegui.readthedocs.io/en/latest/'
205+
196206

197207
if(win_location != '(0,0)'):
198208
window = sg.Window(GUI_Version + " | " + ups2Version, layout, location = eval(win_location))
@@ -217,12 +227,16 @@ def ecFormatDisplay(sysStatus, window):
217227
elif event == 'Standby':
218228
if ecPopWin(5, 'Standby') != 'cancel':
219229
os.system('sudo shutdown now\n')
220-
elif event == 'About':
221-
print('About event')
230+
elif event == 'UPS-2 GUI':
231+
print('About UPS-2 GUI')
232+
sg.popup(str_about_GUI, title = 'About UPS-2 GUI', location = eval(win_location))
233+
elif event == 'UPS-2 Firmware':
234+
print('About UPS-2 Firmware')
235+
sg.popup(str_about_FW, title = 'About UPS-2 Firmware', location = eval(win_location))
222236
elif event == 'Browse...':
223237
print ('FW update')
224238
window.hide()
225-
FW_upd.GetUpdDialog()
239+
FW_upd.GetUpdDialog(eval(win_location))
226240
window.un_hide() #todo: close, if not cancelled
227241

228242
if divider < 100: #main processing tick = 1s
@@ -240,7 +254,8 @@ def ecFormatDisplay(sysStatus, window):
240254
fT.seek(0) #reset to first line
241255
piTemp = piTemp[0:2] + '°C'
242256
#set display attributes
243-
ecFormatDisplay(sysStatus, window)
257+
# ecFormatDisplay(sysStatus, window)
258+
244259
#update values
245260
window['K_MAIN_V'].update(AnalogList[0])
246261
window['K_BATT_V'].update(AnalogList[1])

ups2_GUI_develop.py

100755100644
File mode changed.

ups_GUI.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Window]
2+
position_xy = (550, 336)
3+

0 commit comments

Comments
 (0)