smartport: removed disabling on timeout
and refuse to initialise in case the port is shared with something else (would not work anyway).
This commit is contained in:
parent
8dfd820722
commit
07a6cf92b7
|
@ -64,8 +64,7 @@ enum
|
|||
{
|
||||
SPSTATE_UNINITIALIZED,
|
||||
SPSTATE_INITIALIZED,
|
||||
SPSTATE_WORKING,
|
||||
SPSTATE_TIMEDOUT
|
||||
SPSTATE_WORKING
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -145,7 +144,6 @@ const uint16_t frSkyDataIdTable[] = {
|
|||
#define SMARTPORT_BAUD 57600
|
||||
#define SMARTPORT_UART_MODE MODE_RXTX
|
||||
#define SMARTPORT_SERVICE_TIMEOUT_MS 1 // max allowed time to find a value to send
|
||||
#define SMARTPORT_NOT_CONNECTED_TIMEOUT_MS 7000
|
||||
|
||||
static serialPort_t *smartPortSerialPort = NULL; // The 'SmartPort'(tm) Port.
|
||||
static serialPortConfig_t *portConfig;
|
||||
|
@ -352,15 +350,9 @@ bool canSendSmartPortTelemetry(void)
|
|||
return smartPortSerialPort && (smartPortState == SPSTATE_INITIALIZED || smartPortState == SPSTATE_WORKING);
|
||||
}
|
||||
|
||||
bool isSmartPortTimedOut(void)
|
||||
{
|
||||
return smartPortState >= SPSTATE_TIMEDOUT;
|
||||
}
|
||||
|
||||
void checkSmartPortTelemetryState(void)
|
||||
{
|
||||
bool newTelemetryEnabledValue = telemetryDetermineEnabledState(smartPortPortSharing);
|
||||
|
||||
bool newTelemetryEnabledValue = (smartPortPortSharing == PORTSHARING_NOT_SHARED);
|
||||
if (newTelemetryEnabledValue == smartPortTelemetryEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -578,14 +570,6 @@ void handleSmartPortTelemetry(void)
|
|||
smartPortDataReceive(c);
|
||||
}
|
||||
|
||||
uint32_t now = millis();
|
||||
|
||||
// if timed out, reconfigure the UART back to normal so the GUI or CLI works
|
||||
if ((now - smartPortLastRequestTime) > SMARTPORT_NOT_CONNECTED_TIMEOUT_MS) {
|
||||
smartPortState = SPSTATE_TIMEDOUT;
|
||||
return;
|
||||
}
|
||||
|
||||
if(smartPortFrameReceived) {
|
||||
smartPortFrameReceived = false;
|
||||
// do not check the physical ID here again
|
||||
|
|
|
@ -15,5 +15,3 @@ void checkSmartPortTelemetryState(void);
|
|||
void configureSmartPortTelemetryPort(void);
|
||||
void freeSmartPortTelemetryPort(void);
|
||||
|
||||
bool isSmartPortTimedOut(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue