parent
09ca43568c
commit
b0b97da2d0
|
|
@ -36,7 +36,7 @@ void setup()
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Read the throttle value from the USB serial input
|
// Read the throttle value from the USB serial input
|
||||||
auto throttle_input = readSerialThrottle();
|
int throttle_input = read_SerialThrottle();
|
||||||
|
|
||||||
// Set the throttle value to either the value received from the serial input or the failsafe throttle value
|
// Set the throttle value to either the value received from the serial input or the failsafe throttle value
|
||||||
auto throttle_value = (throttle_input > 0) ? throttle_input : FAILSAFE_THROTTLE;
|
auto throttle_value = (throttle_input > 0) ? throttle_input : FAILSAFE_THROTTLE;
|
||||||
|
|
@ -46,13 +46,11 @@ void loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the throttle value from the USB serial input
|
// Read the throttle value from the USB serial input
|
||||||
uint16_t readSerialThrottle()
|
int read_SerialThrottle()
|
||||||
{
|
{
|
||||||
if (USB_Serial.available() > 0)
|
if (USB_Serial.available() > 0)
|
||||||
{
|
{
|
||||||
return USB_Serial.readStringUntil('\n').toInt();
|
auto throttle_input = (USB_Serial.readStringUntil('\n')).toInt();
|
||||||
} else
|
return throttle_input;
|
||||||
{
|
|
||||||
return FAILSAFE_THROTTLE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue