SEWcontrol: allow to set zero speed

This commit is contained in:
Edward Emelianov 2022-03-04 14:52:58 +03:00
parent d3b4a8b4bc
commit 0da6bce6e9
2 changed files with 2 additions and 1 deletions

View File

@ -29,6 +29,7 @@
static int help;
static glob_pars G = {
.path = DEFAULT_SOCKPATH,
.setspeed = INT_MAX,
};
glob_pars *GP = &G;

View File

@ -83,7 +83,7 @@ int main(int argc, char **argv){
#endif
*/
CANcmd mesg = CMD_GETSPEED;
if(GP->setspeed){
if(GP->setspeed != INT_MAX){
if(GP->stop) ERRX("Commands 'stop' and 'set speed' can't be together");
if(GP->setspeed < -0xffff/5 || GP->setspeed > 0xffff/5) ERRX("Parameter 'set speed' should be |int16_t| < %d", 0xffff/5);
mesg = CMD_SETSPEED;