more precision

This commit is contained in:
awe
2026-07-29 18:29:37 +03:00
parent c6a7e84558
commit 06d0714932
2 changed files with 14 additions and 9 deletions
+13 -8
View File
@@ -56,6 +56,11 @@ def read_pi_coeff(values, key, params, param_key):
def shorten(i): def shorten(i):
return "{:.2f}".format(round(i, 2)) return "{:.2f}".format(round(i, 2))
def shorten4(i):
# Higher-precision readout (0.0001) for temperature/current — needed to see
# small fluctuations while tuning the PI controller for temperature stability.
return "{:.4f}".format(round(i, 4))
def set_initial_params(): def set_initial_params():
params = {} params = {}
@@ -447,15 +452,15 @@ if __name__ == "__main__":
update_data_lists() update_data_lists()
window['-TOUT_1-'].update(gui.READ_TEMPERATURE_TEXT+' 1: '+shorten(data['Temp_1'])+' C') window['-TOUT_1-'].update(gui.READ_TEMPERATURE_TEXT+' 1: '+shorten4(data['Temp_1'])+' C')
window['-TOUT_2-'].update(gui.READ_TEMPERATURE_TEXT+' 2: '+shorten(data['Temp_2'])+' C') window['-TOUT_2-'].update(gui.READ_TEMPERATURE_TEXT+' 2: '+shorten4(data['Temp_2'])+' C')
window['-IOUT_1-'].update(gui.READ_CURRENT_TEXT+' 1: '+shorten(data['I1'])+' мА') window['-IOUT_1-'].update(gui.READ_CURRENT_TEXT+' 1: '+shorten4(data['I1'])+' мА')
window['-IOUT_2-'].update(gui.READ_CURRENT_TEXT+' 2: '+shorten(data['I2'])+' мА') window['-IOUT_2-'].update(gui.READ_CURRENT_TEXT+' 2: '+shorten4(data['I2'])+' мА')
window['-DateTime-'].update(data['datetime'].strftime('%d-%m-%Y %H:%M:%S:%f')[:-3]) window['-DateTime-'].update(data['datetime'].strftime('%d-%m-%Y %H:%M:%S:%f')[:-3])
window['-TTerm1-'].update('T терм 1: '+shorten(data['Temp_Ext_1'])+' C') window['-TTerm1-'].update('T терм 1: '+shorten4(data['Temp_Ext_1'])+' C')
window['-TTerm2-'].update('T терм 2: '+shorten(data['Temp_Ext_2'])+' C') window['-TTerm2-'].update('T терм 2: '+shorten4(data['Temp_Ext_2'])+' C')
window['-I1_PANEL-'].update('I1: '+shorten(data['I1'])+' мА') window['-I1_PANEL-'].update('I1: '+shorten4(data['I1'])+' мА')
window['-I2_PANEL-'].update('I2: '+shorten(data['I2'])+' мА') window['-I2_PANEL-'].update('I2: '+shorten4(data['I2'])+' мА')
window['-3V3-'].update('3V3: '+shorten(data['MON_3V3'])+' В') window['-3V3-'].update('3V3: '+shorten(data['MON_3V3'])+' В')
window['-5V1-'].update('5V1: '+shorten(data['MON_5V1'])+' В') window['-5V1-'].update('5V1: '+shorten(data['MON_5V1'])+' В')
window['-5V2-'].update('5V2: '+shorten(data['MON_5V2'])+' В') window['-5V2-'].update('5V2: '+shorten(data['MON_5V2'])+' В')
+1 -1
View File
@@ -58,7 +58,7 @@ GRAPH_I_MAX = 1.0 # mA
READ_TEMPERATURE_TEXT = 'Температура лазера' READ_TEMPERATURE_TEXT = 'Температура лазера'
READ_CURRENT_TEXT = 'Ток фотодиода' READ_CURRENT_TEXT = 'Ток фотодиода'
VOLTAGE_TEXT_WIDTH = 15 VOLTAGE_TEXT_WIDTH = 18
H_SEPARATOR_PAD = (1, 20) H_SEPARATOR_PAD = (1, 20)
OUTPUT_TEXT_PAD = (5, (20, 5)) OUTPUT_TEXT_PAD = (5, (20, 5))
WINDOW_MARGIN = (60, 90) WINDOW_MARGIN = (60, 90)