File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ int32_t atoi(char* buf)
144
144
}
145
145
buf ++ ;
146
146
}
147
+ if (buf [0 ] == '-' )
148
+ {
149
+ ret = - ret ;
150
+ }
147
151
return ret ;
148
152
}
149
153
@@ -1242,10 +1246,18 @@ int32_t extended_command_analyze(char* data)
1242
1246
}
1243
1247
else if (strstr (data , "$SETSOFTBRAKEMS" ) == data )
1244
1248
{
1245
- saved_param .soft_brake_ms = atoi (data + 15 );
1246
-
1247
- send (data );
1248
- send ("\n00P\n\n" );
1249
+ const int32_t v = atoi (data + 15 );
1250
+ if (v < 0 || v > 10000 )
1251
+ {
1252
+ send (data );
1253
+ send ("\n01Q\nOut of range\n\n" );
1254
+ }
1255
+ else
1256
+ {
1257
+ saved_param .soft_brake_ms = v ;
1258
+ send (data );
1259
+ send ("\n00P\n\n" );
1260
+ }
1249
1261
}
1250
1262
else if (strstr (data , "$SETBUZZERLEVEL" ) == data )
1251
1263
{
You can’t perform that action at this time.
0 commit comments