kopia lustrzana https://github.com/sh123/esp32_loraprs
Simplify repeated code
rodzic
1300b7c0ce
commit
08f3bcb413
|
@ -421,8 +421,7 @@ bool Service::onSerialRxHasData()
|
||||||
|
|
||||||
bool Service::onSerialRx(byte *b)
|
bool Service::onSerialRx(byte *b)
|
||||||
{
|
{
|
||||||
if (config_.BtEnableBle) {
|
int rxResult = config_.BtEnableBle ? serialBLE_.read() : serialBt_.read();
|
||||||
int rxResult = serialBLE_.read();
|
|
||||||
if (rxResult == -1) {
|
if (rxResult == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -430,16 +429,6 @@ bool Service::onSerialRx(byte *b)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
|
||||||
int rxResult = serialBt_.read();
|
|
||||||
if (rxResult == -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*b = (byte)rxResult;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Service::onControlCommand(Cmd cmd, byte value)
|
void Service::onControlCommand(Cmd cmd, byte value)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|
Ładowanie…
Reference in New Issue