some fixes

This commit is contained in:
2026-09-03 16:22:24 +03:00
parent ae999fcd48
commit d2463f759b
8 changed files with 154 additions and 112 deletions

View File

@@ -281,8 +281,8 @@ sl_sock_hresult_e speed_handler(int _U_ index, char _U_ value[SL_VAL_LEN]){
double D;
if(ISSETTER(value)){
if(forbidden) return RESULT_FAIL;
if(!sl_str2d(&D, value) || !motors_set_speedsetpoint(D)) return RESULT_BADVAL;
return RESULT_OK;
if(!sl_str2d(&D, value)) return RESULT_BADVAL;
return motors_set_speedsetpoint(D);
}
snprintf(value, SL_VAL_LEN-1, "%.3f", motors_get_speedsetpoint());
return RESULT_SILENCE;
@@ -293,6 +293,11 @@ sl_sock_hresult_e stop_handler(int _U_ index, char _U_ value[SL_VAL_LEN]){
return RESULT_OK;
}
sl_sock_hresult_e nmotors_handler(int _U_ index, char _U_ value[SL_VAL_LEN]){
snprintf(value, SL_VAL_LEN-1, "%d", motors_get_working_amount());
return RESULT_SILENCE;
}
// binary search handler by name
static int search_handler(const char *name){
int low = 0;