diff --git a/conf/template/hx.txt b/conf/template/hx.txt new file mode 100644 index 00000000..86aa6175 --- /dev/null +++ b/conf/template/hx.txt @@ -0,0 +1,3 @@ +load hx +hx0.rt_prio = 1.5 +hx0.gain = 100 \ No newline at end of file diff --git a/shared/comps/fmove.c b/shared/comps/fmove.c index 2d216e57..b0216647 100644 --- a/shared/comps/fmove.c +++ b/shared/comps/fmove.c @@ -110,7 +110,7 @@ static void rt_func(float period, void *ctx_ptr, hal_pin_inst_t *pin_ptr) { PIN(print_timer) += period; if(PIN(en) <= 0.0){ - PIN(force_offset) += PIN(force) * 0.1 * period; + PIN(force_offset) += PIN(force) * 0.5 * period; PIN(pos) = 0.0; PIN(mpos) = 0.0; PIN(vel) = 0.0; diff --git a/shared/comps/uvw.c b/shared/comps/uvw.c index 9fb600a7..554c5d6a 100644 --- a/shared/comps/uvw.c +++ b/shared/comps/uvw.c @@ -65,7 +65,7 @@ static void rt_func(float period, void *ctx_ptr, hal_pin_inst_t *pin_ptr) { t[6] = PIN(p6); t[7] = PIN(p7); PIN(rpos) = rpos; - if(PIN(amp) < 0.75){ + if(PIN(amp) < 0.75){ // fix wire saving PIN(error) = 1.0; PIN(state) = 0.0; PIN(timer) = 0.0; diff --git a/src/comps/hx711.c b/src/comps/hx711.c index 180bb8f3..51edd436 100644 --- a/src/comps/hx711.c +++ b/src/comps/hx711.c @@ -48,6 +48,15 @@ static void nopsleep(uint32_t t){ } } +static void nrt_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) { + //struct hx_ctx_t *ctx = (struct hx_ctx_t *)ctx_ptr; + struct hx_pin_ctx_t * pins = (struct hx_pin_ctx_t *)pin_ptr; + + PIN(sleep) = 20; + PIN(time) = 0.01; + PIN(gain) = 1; +} + static void hw_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) { //struct hx_ctx_t *ctx = (struct hx_ctx_t *)ctx_ptr; struct hx_pin_ctx_t * pins = (struct hx_pin_ctx_t *)pin_ptr; @@ -69,9 +78,6 @@ static void hw_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) { GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(FB1_Z_PORT, &GPIO_InitStruct); - - PIN(sleep) = 20; - PIN(time) = 1.0 / 80.0; } //TODO: plausibility, saturation, channel/gain config, 2 chips @@ -144,7 +150,7 @@ hal_comp_t hx_comp_struct = { .nrt = 0, .rt = rt_func, .frt = 0, - .nrt_init = 0, + .nrt_init = nrt_init, .hw_init = hw_init, .rt_start = 0, .frt_start = 0,