Добавлена Проверка навигации на сбой приемника и перенесен прием навигации в другой поток
This commit is contained in:
parent
263b152442
commit
0a3c8470dc
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// Created by cfif on 19.12.2024.
|
||||
//
|
||||
|
||||
#ifndef UVEOS_ON_NATION_ATGSMGNSS_H
|
||||
#define UVEOS_ON_NATION_ATGSMGNSS_H
|
||||
|
||||
#include "AtCmdBase.h"
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssStartStop(
|
||||
tAtCmd *env,
|
||||
bool isStartStop
|
||||
);
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssClearBuffer(
|
||||
tAtCmd *env
|
||||
);
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssResetColdstart(
|
||||
tAtCmd *env
|
||||
);
|
||||
|
||||
#endif //UVEOS_ON_NATION_ATGSMGNSS_H
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
//
|
||||
// Created by cfif on 19.12.2024.
|
||||
//
|
||||
#include <SystemDelayInterface.h>
|
||||
#include "AtCmdCommonProtected.h"
|
||||
#include "AsciiStringParsingUtils.h"
|
||||
#include "AtGsmQuerySignalQuality.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssStartStop(
|
||||
tAtCmd *env,
|
||||
bool isStartStop
|
||||
) {
|
||||
|
||||
AtCmdTxClear(env);
|
||||
AtCmdTxAddStatic(env, "AT$GPSP=");
|
||||
AtCmdTxAddChar(env, isStartStop ? '1' : '0');
|
||||
AtCmdTxSendLn(env);
|
||||
|
||||
uint32_t timeout = 1000;
|
||||
uint32_t endMs = SystemGetMs() + timeout;
|
||||
uint32_t leftMs = timeout;
|
||||
|
||||
while ((AtCmdReceiveNextLine(env, leftMs) == AT_OK) && (SystemGetMs() < endMs)) {
|
||||
leftMs = endMs - SystemGetMs();
|
||||
|
||||
if (AtCmdRxBeginWithStatic(env, "OK")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_OK;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "ERROR")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "+CME ERROR: ")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else {
|
||||
AtCmdProcessUnresolvedLine(env);
|
||||
AtCmdRxClear(env);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return AT_TIMEOUT;
|
||||
}
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssResetColdstart(
|
||||
tAtCmd *env
|
||||
) {
|
||||
|
||||
AtCmdPrepare(env);
|
||||
|
||||
AtCmdTxClear(env);
|
||||
AtCmdSendStatic(env, "AT$GPSR=1\r\n");
|
||||
|
||||
uint32_t timeout = 1000;
|
||||
uint32_t endMs = SystemGetMs() + timeout;
|
||||
uint32_t leftMs = timeout;
|
||||
|
||||
while ((AtCmdReceiveNextLine(env, leftMs) == AT_OK) && (SystemGetMs() < endMs)) {
|
||||
leftMs = endMs - SystemGetMs();
|
||||
|
||||
if (AtCmdRxBeginWithStatic(env, "OK")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_OK;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "ERROR")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "+CME ERROR: ")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else {
|
||||
AtCmdProcessUnresolvedLine(env);
|
||||
AtCmdRxClear(env);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return AT_TIMEOUT;
|
||||
}
|
||||
|
||||
AtCommandResult AtGsm_ReceiverGnssClearBuffer(
|
||||
tAtCmd *env
|
||||
) {
|
||||
|
||||
AtCmdPrepare(env);
|
||||
|
||||
AtCmdTxClear(env);
|
||||
AtCmdSendStatic(env, "AT$GPSNVRAM=15,0\r\n");
|
||||
|
||||
uint32_t timeout = 1000;
|
||||
uint32_t endMs = SystemGetMs() + timeout;
|
||||
uint32_t leftMs = timeout;
|
||||
|
||||
while ((AtCmdReceiveNextLine(env, leftMs) == AT_OK) && (SystemGetMs() < endMs)) {
|
||||
leftMs = endMs - SystemGetMs();
|
||||
|
||||
if (AtCmdRxBeginWithStatic(env, "OK")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_OK;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "ERROR")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else if (AtCmdRxBeginWithStatic(env, "+CME ERROR: ")) {
|
||||
AtCmdRxClear(env);
|
||||
return AT_ERROR;
|
||||
} else {
|
||||
AtCmdProcessUnresolvedLine(env);
|
||||
AtCmdRxClear(env);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return AT_TIMEOUT;
|
||||
}
|
||||
Loading…
Reference in New Issue