diff --git a/_device_main.py b/_device_main.py index 941b94b..c894975 100644 --- a/_device_main.py +++ b/_device_main.py @@ -56,6 +56,11 @@ def read_pi_coeff(values, key, params, param_key): def shorten(i): 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(): params = {} @@ -447,15 +452,15 @@ if __name__ == "__main__": update_data_lists() - window['-TOUT_1-'].update(gui.READ_TEMPERATURE_TEXT+' 1: '+shorten(data['Temp_1'])+' C') - window['-TOUT_2-'].update(gui.READ_TEMPERATURE_TEXT+' 2: '+shorten(data['Temp_2'])+' C') - window['-IOUT_1-'].update(gui.READ_CURRENT_TEXT+' 1: '+shorten(data['I1'])+' мА') - window['-IOUT_2-'].update(gui.READ_CURRENT_TEXT+' 2: '+shorten(data['I2'])+' мА') + window['-TOUT_1-'].update(gui.READ_TEMPERATURE_TEXT+' 1: '+shorten4(data['Temp_1'])+' C') + window['-TOUT_2-'].update(gui.READ_TEMPERATURE_TEXT+' 2: '+shorten4(data['Temp_2'])+' C') + window['-IOUT_1-'].update(gui.READ_CURRENT_TEXT+' 1: '+shorten4(data['I1'])+' мА') + 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['-TTerm1-'].update('T терм 1: '+shorten(data['Temp_Ext_1'])+' C') - window['-TTerm2-'].update('T терм 2: '+shorten(data['Temp_Ext_2'])+' C') - window['-I1_PANEL-'].update('I1: '+shorten(data['I1'])+' мА') - window['-I2_PANEL-'].update('I2: '+shorten(data['I2'])+' мА') + window['-TTerm1-'].update('T терм 1: '+shorten4(data['Temp_Ext_1'])+' C') + window['-TTerm2-'].update('T терм 2: '+shorten4(data['Temp_Ext_2'])+' C') + window['-I1_PANEL-'].update('I1: '+shorten4(data['I1'])+' мА') + window['-I2_PANEL-'].update('I2: '+shorten4(data['I2'])+' мА') window['-3V3-'].update('3V3: '+shorten(data['MON_3V3'])+' В') window['-5V1-'].update('5V1: '+shorten(data['MON_5V1'])+' В') window['-5V2-'].update('5V2: '+shorten(data['MON_5V2'])+' В') diff --git a/gui.py b/gui.py index e9239b1..93b4bc2 100644 --- a/gui.py +++ b/gui.py @@ -58,7 +58,7 @@ GRAPH_I_MAX = 1.0 # mA READ_TEMPERATURE_TEXT = 'Температура лазера' READ_CURRENT_TEXT = 'Ток фотодиода' -VOLTAGE_TEXT_WIDTH = 15 +VOLTAGE_TEXT_WIDTH = 18 H_SEPARATOR_PAD = (1, 20) OUTPUT_TEXT_PAD = (5, (20, 5)) WINDOW_MARGIN = (60, 90)