diff --git a/esp8266-laser.ino b/esp8266-laser.ino index ba7f5ec..cd37a61 100644 --- a/esp8266-laser.ino +++ b/esp8266-laser.ino @@ -119,7 +119,14 @@ void handleFileList() { void handleLaser(String uri) { String laserValue = uri.substring(7); - lmValues[0] = laserValue.toInt(); + if(laserValue.toInt() > 128) { + lmValues[0] = 128; + laserValue = "128"; + } + else + { + lmValues[0] = laserValue.toInt(); + } String msg = "AT SLV "; msg += laserValue; @@ -138,9 +145,15 @@ void handleLaser(String uri) void handleMotor(String uri) { String motorNr = uri.substring(7, 8); - String motorValue = uri.substring(9); - lmValues[motorNr.toInt()] = motorValue.toInt(); - + String motorValue = uri.substring(9); + if(motorValue.toInt() > 128) { + lmValues[motorNr.toInt()] = 128; + motorValue = "128"; + } + else + { + lmValues[motorNr.toInt()] = motorValue.toInt(); + } String msg = "AT SMS "; msg += motorNr; msg += " ";