mirror of
https://github.com/0x1d/esp8266-laser.git
synced 2025-12-14 18:15:22 +01:00
added value cap to laser and motorValues
This commit is contained in:
@@ -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 += " ";
|
||||
|
||||
Reference in New Issue
Block a user