Created regulated output

This commit is contained in:
2024-04-13 14:20:45 +03:00
parent e4bd6d2e04
commit 91a7247bee
8 changed files with 189 additions and 21 deletions

View File

@@ -29,8 +29,25 @@ int main(void)
// Read saved config
cfg_mem.init();
#ifdef OVERRIDE_CONFIG
cfg_mem.btn_force = 0;
cfg_mem.bmode = 0;
cfg_mem.pot_mode = 0;
cfg_mem.dsp_brigth = 100;
cfg_mem.dsp_dimm = 50;
cfg_mem.brake_force = 100;
cfg_mem.max_hbrake_time = 1000;
cfg_mem.lock_current = 4200;
cfg_mem.max_out_voltage = 6500;
cfg_mem.min_out_voltage = 500;
cfg_mem.save_all();
#endif
uint8_t user_force = 0;
ccout.max_voltage = cfg_mem.max_out_voltage;
ccout.min_voltage = cfg_mem.min_out_voltage;
button_force.force = cfg_mem.btn_force;
dccd_force.brake_mode = cfg_mem.bmode;
dccd_force.max_hbrake_time = cfg_mem.max_hbrake_time;
@@ -56,7 +73,7 @@ int main(void)
if((sup_fuse.fault)||(out_fuse.fault)) dccd_force.force = 0;
// Convert force to current
ccout.target = util::percent_of(dccd_force.force, cfg_mem.lock_current);
ccout.max_current = util::percent_of(dccd_force.force, cfg_mem.lock_current);
// Execute outputs
ccout.update();