syringe data
This commit is contained in:
parent
08ba48afa5
commit
81d462d08e
@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
#include "PSE_unit.h"
|
#include "PSE_unit.h"
|
||||||
|
|
||||||
|
static pse_syringe test_syringe = {
|
||||||
|
.name = "test",
|
||||||
|
.diameter = 10000,
|
||||||
|
};
|
||||||
|
|
||||||
// Dummy loading function until I decide between loading from SPIFlash or SD-MMC
|
// Dummy loading function until I decide between loading from SPIFlash or SD-MMC
|
||||||
void load_units(pse_unit* units, uint8_t unit_num){
|
void load_units(pse_unit* units, uint8_t unit_num){
|
||||||
for(int i = 0; i < unit_num; i++){
|
for(int i = 0; i < unit_num; i++){
|
||||||
@ -16,6 +21,7 @@ void load_units(pse_unit* units, uint8_t unit_num){
|
|||||||
.flow = 1500*i,
|
.flow = 1500*i,
|
||||||
.volume = 0,
|
.volume = 0,
|
||||||
.set_volume = 0,
|
.set_volume = 0,
|
||||||
|
.syringe = &test_syringe,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -42,6 +42,35 @@ static lv_obj_t* flow_widget(lv_obj_t* parent, pse_unit* unit){
|
|||||||
lv_label_set_text_fmt(flow, "Debit : \n%d.%d\nmL/mn", unit->flow / 1000, unit->flow % 1000);
|
lv_label_set_text_fmt(flow, "Debit : \n%d.%d\nmL/mn", unit->flow / 1000, unit->flow % 1000);
|
||||||
return cont;
|
return cont;
|
||||||
}
|
}
|
||||||
|
static lv_obj_t* volume_widget(lv_obj_t* parent, pse_unit* unit){
|
||||||
|
// The main container
|
||||||
|
lv_obj_t* cont = lv_obj_create(parent);
|
||||||
|
lv_obj_set_size(cont, lv_pct(24), lv_pct(100));
|
||||||
|
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
|
||||||
|
// lv_obj_add_event_cb(cont, unit_widget_clicked_handler, LV_EVENT_ALL, pse_unit);
|
||||||
|
|
||||||
|
// volume setting
|
||||||
|
lv_obj_t* vol = lv_label_create(cont);
|
||||||
|
lv_obj_set_width(vol, lv_pct(100));
|
||||||
|
lv_obj_set_flex_grow(vol, 1);
|
||||||
|
lv_label_set_text_fmt(vol, "Volume : \n%d.%d\nmL", unit->set_volume / 1000, unit->set_volume % 1000);
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
static lv_obj_t* syringe_widget(lv_obj_t* parent, pse_unit* unit){
|
||||||
|
// The main container
|
||||||
|
lv_obj_t* cont = lv_obj_create(parent);
|
||||||
|
lv_obj_set_size(cont, lv_pct(24), lv_pct(100));
|
||||||
|
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
|
||||||
|
// lv_obj_add_event_cb(cont, unit_widget_clicked_handler, LV_EVENT_ALL, pse_unit);
|
||||||
|
|
||||||
|
pse_syringe* syringe = unit->syringe;
|
||||||
|
// syringe setting
|
||||||
|
lv_obj_t* vol = lv_label_create(cont);
|
||||||
|
lv_obj_set_width(vol, lv_pct(100));
|
||||||
|
lv_obj_set_flex_grow(vol, 1);
|
||||||
|
lv_label_set_text_fmt(vol, "Seringue : \n%s\nD %d.%d mm", syringe->name, syringe->diameter/1000, syringe->diameter%1000);
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
|
||||||
void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* unit){
|
void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* unit){
|
||||||
parent_screen = parent;
|
parent_screen = parent;
|
||||||
@ -75,8 +104,14 @@ void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* unit){
|
|||||||
lv_obj_set_grid_dsc_array(units_grid, widg_col_dsc, widg_row_dsc);
|
lv_obj_set_grid_dsc_array(units_grid, widg_col_dsc, widg_row_dsc);
|
||||||
|
|
||||||
// Flow widget
|
// Flow widget
|
||||||
lv_obj_t* obj = flow_widget(units_grid, unit);
|
lv_obj_t* flow = flow_widget(units_grid, unit);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(flow, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
// Set volume widget
|
||||||
|
lv_obj_t* vol = volume_widget(units_grid, unit);
|
||||||
|
lv_obj_set_grid_cell(vol, LV_GRID_ALIGN_CENTER, 1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
// Syringe widget
|
||||||
|
lv_obj_t* syringe = syringe_widget(units_grid, unit);
|
||||||
|
lv_obj_set_grid_cell(syringe, LV_GRID_ALIGN_CENTER, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
|
||||||
// fade in the new screen
|
// fade in the new screen
|
||||||
lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_FADE_ON, 100, 100, false);
|
lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_FADE_ON, 100, 100, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user