Commit 8dabbb98 authored by dogmaphobic's avatar dogmaphobic

Stop annoying errors when there is no serial device.

parent 9500b4e2
......@@ -50,6 +50,8 @@ static const char V_TAG[] {"QGC_QSerialPortInfo"};
extern void cleanJavaException();
static int gErrorCount = 0;
QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok)
{
QList<QSerialPortInfo> serialPortInfoList;
......@@ -61,9 +63,15 @@ QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok)
"()[Ljava/lang/String;");
if (!resultL.isValid()) {
__android_log_print(ANDROID_LOG_ERROR, V_TAG, "Error from availableDevicesInfo");
//-- If 5 consecutive errors, ignore it.
if(gErrorCount < 5) {
gErrorCount++;
__android_log_print(ANDROID_LOG_ERROR, V_TAG, "Error from availableDevicesInfo");
}
ok = false;
return serialPortInfoList;
} else {
gErrorCount = 0;
}
QAndroidJniEnvironment envL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment