mirror of
https://github.com/0x1d/esp8266-laser.git
synced 2025-12-16 10:44:30 +01:00
added value cap to laser and motorValues
This commit is contained in:
@@ -119,7 +119,14 @@ void handleFileList() {
|
|||||||
void handleLaser(String uri)
|
void handleLaser(String uri)
|
||||||
{
|
{
|
||||||
String laserValue = uri.substring(7);
|
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 ";
|
String msg = "AT SLV ";
|
||||||
msg += laserValue;
|
msg += laserValue;
|
||||||
@@ -139,8 +146,14 @@ void handleMotor(String uri)
|
|||||||
{
|
{
|
||||||
String motorNr = uri.substring(7, 8);
|
String motorNr = uri.substring(7, 8);
|
||||||
String motorValue = uri.substring(9);
|
String motorValue = uri.substring(9);
|
||||||
lmValues[motorNr.toInt()] = motorValue.toInt();
|
if(motorValue.toInt() > 128) {
|
||||||
|
lmValues[motorNr.toInt()] = 128;
|
||||||
|
motorValue = "128";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lmValues[motorNr.toInt()] = motorValue.toInt();
|
||||||
|
}
|
||||||
String msg = "AT SMS ";
|
String msg = "AT SMS ";
|
||||||
msg += motorNr;
|
msg += motorNr;
|
||||||
msg += " ";
|
msg += " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user