hx, fmove

This commit is contained in:
crinq
2020-02-24 15:21:24 +01:00
parent 7ad0175e31
commit df05d0ad63
4 changed files with 15 additions and 6 deletions
+3
View File
@@ -0,0 +1,3 @@
load hx
hx0.rt_prio = 1.5
hx0.gain = 100
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+10 -4
View File
@@ -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,