mirror of
https://github.com/rene-dev/stmbl.git
synced 2024-12-25 10:02:18 +00:00
format
This commit is contained in:
parent
b934d2ce69
commit
b323747c48
@ -22,19 +22,20 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
|
||||
float vel_error = PIN(vel_ext_cmd) - PIN(vel_fb);
|
||||
|
||||
PIN(vel_cmd) = PIN(vel_fb) + LIMIT(vel_error, PIN(max_acc) * period) * LIMIT(5.0 * (1.0 - ABS(PIN(torque_fb)) / MAX(PIN(scale) * PIN(max_torque), 0.01)), 1.0);;
|
||||
PIN(vel_cmd) = PIN(vel_fb) + LIMIT(vel_error, PIN(max_acc) * period) * LIMIT(5.0 * (1.0 - ABS(PIN(torque_fb)) / MAX(PIN(scale) * PIN(max_torque), 0.01)), 1.0);
|
||||
;
|
||||
}
|
||||
|
||||
hal_comp_t ramp_comp_struct = {
|
||||
.name = "ramp",
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.nrt_init = 0,
|
||||
.rt_start = 0,
|
||||
.frt_start = 0,
|
||||
.rt_stop = 0,
|
||||
.frt_stop = 0,
|
||||
.ctx_size = 0,
|
||||
.pin_count = sizeof(struct ramp_pin_ctx_t) / sizeof(struct hal_pin_inst_t),
|
||||
.name = "ramp",
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.nrt_init = 0,
|
||||
.rt_start = 0,
|
||||
.frt_start = 0,
|
||||
.rt_stop = 0,
|
||||
.frt_stop = 0,
|
||||
.ctx_size = 0,
|
||||
.pin_count = sizeof(struct ramp_pin_ctx_t) / sizeof(struct hal_pin_inst_t),
|
||||
};
|
@ -191,7 +191,7 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
PIN(q_fb) = ctx->packet_from_hv.q_fb;
|
||||
PIN(dc_volt) = ctx->packet_from_hv.dc_volt;
|
||||
PIN(pwm_volt) = ctx->packet_from_hv.pwm_volt;
|
||||
PIN(abs_cur) = sqrtf(PIN(d_fb) * PIN(d_fb) + PIN(q_fb) * PIN(q_fb));
|
||||
PIN(abs_cur) = sqrtf(PIN(d_fb) * PIN(d_fb) + PIN(q_fb) * PIN(q_fb));
|
||||
|
||||
uint16_t a = ctx->packet_from_hv.addr;
|
||||
a = CLAMP(a, 0, sizeof(f3_state_data_t) / 4);
|
||||
|
@ -37,7 +37,7 @@ struct hv_ctx_t {
|
||||
};
|
||||
|
||||
static void nrt_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
struct hv_ctx_t *ctx = (struct hv_ctx_t *)ctx_ptr;
|
||||
struct hv_ctx_t *ctx = (struct hv_ctx_t *)ctx_ptr;
|
||||
// struct hv_pin_ctx_t *pins = (struct hv_pin_ctx_t *)pin_ptr;
|
||||
|
||||
//setup uart to f1. uses DMA to transfer to_hv struct.
|
||||
|
Loading…
Reference in New Issue
Block a user