pL step volume resolution
This commit is contained in:
parent
b16cdb0aec
commit
0676d5dc1f
@ -63,7 +63,7 @@ typedef struct{
|
||||
pse_home_display* home_display; // Widgets for updating the home screen
|
||||
pse_stepper_status* stepper_status; // stepper position/speed status
|
||||
int32_t start_pos; // movement start position for volume calculation
|
||||
uint32_t nL_per_step; // pL delivered per step
|
||||
uint32_t pL_per_step; // pL delivered per step
|
||||
} pse_unit;
|
||||
|
||||
|
||||
|
@ -93,10 +93,11 @@ void load_units(pse_unit* units, pse_syringe* syringes, pse_stepper_conf* steppe
|
||||
|
||||
// set limit if volume defined
|
||||
if(c_pse_unit->set_volume != 0){
|
||||
if(c_pse_unit->nL_per_step == 0) break; // TODO: alert popup / better resolution
|
||||
if(c_pse_unit->pL_per_step == 0) break; // TODO: alert popup / better resolution
|
||||
if(c_pse_unit->flow == 0) break;
|
||||
c_pse_unit->stepper_status->stop_at_limit = 1;
|
||||
c_pse_unit->stepper_status->stop_steps = (uint64_t)1000 * c_pse_unit->set_volume / c_pse_unit->nL_per_step; }
|
||||
c_pse_unit->stepper_status->stop_steps = (uint64_t)1000000 * c_pse_unit->set_volume / c_pse_unit->pL_per_step;
|
||||
}
|
||||
else
|
||||
c_pse_unit->stepper_status->stop_at_limit = 0;
|
||||
}
|
||||
@ -146,11 +147,11 @@ void save_units(pse_unit* units, uint8_t unit_num, uint16_t ws_ind){
|
||||
}
|
||||
|
||||
void pse_unit_compute_volume_delivered(pse_unit* unit){
|
||||
unit->volume = (int64_t)1 * (unit->stepper_status->steps_counter - unit->start_pos) * unit->nL_per_step / 1000;
|
||||
unit->volume = (int64_t)1 * (unit->stepper_status->steps_counter - unit->start_pos) * unit->pL_per_step / 1000000;
|
||||
}
|
||||
|
||||
void pse_unit_compute_volume_per_step(pse_unit* unit){
|
||||
uint64_t numerator = (uint64_t)1 * (unit->syringe->diameter * unit->syringe->diameter) * PSE_STEPPER_SCREW_PITCH;
|
||||
uint64_t numerator = (uint64_t)1000 * (unit->syringe->diameter * unit->syringe->diameter) * PSE_STEPPER_SCREW_PITCH;
|
||||
uint64_t denominator = (uint64_t)1273238 * PSE_STEPPER_STEPS_PER_ROTATION;
|
||||
unit->nL_per_step = numerator / denominator;
|
||||
unit->pL_per_step = numerator / denominator;
|
||||
}
|
||||
|
@ -37,12 +37,14 @@ static void back_button_handler(lv_event_t * e){
|
||||
|
||||
// set limit if volume defined
|
||||
if(c_pse_unit->set_volume != 0){
|
||||
if(c_pse_unit->nL_per_step == 0) return; // TODO: alert popup / better resolution
|
||||
if(c_pse_unit->pL_per_step == 0) return; // TODO: alert popup
|
||||
if(c_pse_unit->flow == 0) return;
|
||||
c_pse_unit->stepper_status->stop_at_limit = 1;
|
||||
c_pse_unit->stepper_status->stop_steps = (uint64_t)1000 * c_pse_unit->set_volume / c_pse_unit->nL_per_step; }
|
||||
c_pse_unit->stepper_status->stop_steps = (uint64_t)1000000 * c_pse_unit->set_volume / c_pse_unit->pL_per_step;
|
||||
}
|
||||
else
|
||||
c_pse_unit->stepper_status->stop_at_limit = 0;
|
||||
printf("dksfghjsdgf %d %d %d\n", c_pse_unit->stepper_status->stop_steps, c_pse_unit->stepper_status->steps_counter, c_pse_unit->start_pos);
|
||||
|
||||
// go back to the main menu
|
||||
Home_Screen_Gen(c_pse_units, c_pse_units_num, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user