syringe diam edit + correct dir
This commit is contained in:
parent
4ed28ba27f
commit
5ff9750e90
@ -20,6 +20,8 @@ void pse_sp_set_dir(pse_stepper_conf* conf, int dir);
|
||||
int pse_sp_get_dir(pse_stepper_conf* conf);
|
||||
void pse_stepper_planer_tick(pse_unit* units, uint8_t units_num);
|
||||
|
||||
|
||||
void pse_sp_set_dir_all(pse_unit* units, int unit_num, int dir);
|
||||
void pse_sp_start_all(pse_unit* units, int unit_num);
|
||||
void pse_sp_stop_all(pse_unit* units, int unit_num);
|
||||
|
||||
|
@ -114,12 +114,33 @@ static lv_obj_t* volume_widget(lv_obj_t* parent, pse_unit* unit){
|
||||
volume_widget_label = vol;
|
||||
return cont;
|
||||
}
|
||||
|
||||
lv_obj_t* syringe_widget_label;
|
||||
static void update_syringe(keypad_data* data){
|
||||
pse_unit* unit = data->user_data;
|
||||
unit->syringe->diameter = data->value;
|
||||
pse_syringe* syringe = unit->syringe;
|
||||
lv_label_set_text_fmt(syringe_widget_label, "Seringue : \n%s\nD %d.%d mm", syringe->name, syringe->diameter/1000, syringe->diameter%1000);
|
||||
}
|
||||
static void syringe_edit_handler(lv_event_t* e){
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
pse_unit* unit = lv_event_get_user_data(e);
|
||||
kp_data = (keypad_data){
|
||||
.parent = this_screen,
|
||||
.cb = update_syringe,
|
||||
.user_data = unit,
|
||||
};
|
||||
Keypad_screen_launch(&kp_data);
|
||||
}
|
||||
}
|
||||
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);
|
||||
lv_obj_add_event_cb(cont, syringe_edit_handler, LV_EVENT_ALL, unit);
|
||||
|
||||
pse_syringe* syringe = unit->syringe;
|
||||
// syringe setting
|
||||
@ -127,6 +148,7 @@ static lv_obj_t* syringe_widget(lv_obj_t* parent, pse_unit* unit){
|
||||
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);
|
||||
syringe_widget_label = vol;
|
||||
return cont;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ static void run_handler(lv_event_t * e){
|
||||
lv_state_t state = lv_obj_get_state(button);
|
||||
if(state & LV_STATE_CHECKED){
|
||||
lv_label_set_text(label, LV_SYMBOL_PAUSE);
|
||||
pse_sp_set_dir_all(units, units_num, 1);
|
||||
pse_sp_start_all(units, units_num);
|
||||
}
|
||||
else{
|
||||
|
@ -70,6 +70,11 @@ void pse_stepper_planer_compute_sps(pse_unit* unit){
|
||||
c->step_itvl = numerator / denominator;
|
||||
}
|
||||
|
||||
void pse_sp_set_dir_all(pse_unit* units, int units_num, int dir){
|
||||
for(int i = 0; i < units_num; i++){
|
||||
pse_sp_set_dir(units[i].stepper_conf, dir);
|
||||
}
|
||||
}
|
||||
|
||||
void pse_sp_start_all(pse_unit* units, int units_num){
|
||||
HAL_TIM_Base_Start_IT(htim);
|
||||
|
Loading…
x
Reference in New Issue
Block a user