Hi Ben,
This is less an issue than exchanging thoughts.
I'm trying to play with profiles apply/read on small MCU such as Arduino.
Those MCU are very limited in term of memory and reading the whole MCCONF is quite difficult.
However, if I want to apply or read the current profile applied, I do need some values of MCCONF packet.
COMM_SET_MCCONF_TEMP requires some values such as duty_min or max and others that can be known only if MCCONF is retrieved.
- What about a "sanity" check that would skip those values if the deserialization of them shows 0.0 ?
For instance :
float32 read_min_duty = buffer_get_float32_auto(data, &ind);
if (read_min_duty > 0.0) { mcconf.l_min_duty = read_min_duty }
That way I can just send a profile with the values to change and send 0.0 for those I don't want to change ?
This isn't elegant (like could be a mask) but at least it keeps backwards compatibility.
- Reading the current profile
This would require an extra command I guess for retrieving needed values.
Something like :
case COMM_GET_MCCONF_TEMP : {
mcconf = *mc_interface_get_configuration();
int32_t ind = 0;
buffer_append_float32_auto(buffer, conf->l_current_max_scale, &ind);
buffer_append_float32_auto(buffer, conf->l_current_min_scale, &ind);
buffer_append_float32_auto(buffer, conf->l_min_erpm, &ind);
buffer_append_float32_auto(buffer, conf->l_max_erpm, &ind);
buffer_append_float32_auto(buffer, conf->l_min_duty, &ind);
buffer_append_float32_auto(buffer, conf->l_max_duty, &ind);
buffer_append_float32_auto(buffer, conf->l_watt_min, &ind);
buffer_append_float32_auto(buffer, conf->l_watt_max, &ind);
buffer_append_float32_auto(buffer, conf->l_in_current_min, &ind);
buffer_append_float32_auto(buffer, conf->l_in_current_max, &ind);
//needed for speed calculation
buffer[ind++] = (uint8_t)conf->si_motor_poles;
buffer_append_float32_auto(buffer, conf->si_gear_ratio, &ind);
buffer_append_float32_auto(buffer, conf->si_wheel_diameter, &ind);
} break;
The purpose of this is to be able to change the mode on-the-fly by a very simple user interface (e.g a selector button on bike handlebar) without the need of a smartphone.
I would be grateful to know your thoughts on this.
Thanks !
Hi Ben,
This is less an issue than exchanging thoughts.
I'm trying to play with profiles apply/read on small MCU such as Arduino.
Those MCU are very limited in term of memory and reading the whole MCCONF is quite difficult.
However, if I want to apply or read the current profile applied, I do need some values of MCCONF packet.
COMM_SET_MCCONF_TEMP requires some values such as duty_min or max and others that can be known only if MCCONF is retrieved.
For instance :
That way I can just send a profile with the values to change and send 0.0 for those I don't want to change ?
This isn't elegant (like could be a mask) but at least it keeps backwards compatibility.
This would require an extra command I guess for retrieving needed values.
Something like :
The purpose of this is to be able to change the mode on-the-fly by a very simple user interface (e.g a selector button on bike handlebar) without the need of a smartphone.
I would be grateful to know your thoughts on this.
Thanks !