From 5fa0a934cc6c8951346e92eed3254406c78214f3 Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 18 Dec 2024 18:15:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=B5=D0=B4=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainModesArbiter.c | 56 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/MainModesArbiter.c b/MainModesArbiter.c index 321041e..f8aaefd 100644 --- a/MainModesArbiter.c +++ b/MainModesArbiter.c @@ -17,6 +17,7 @@ #define LOGGER &env->slog.logger #ifdef UVEOS_ADD_TELEMATICA + void TELEMATICA_START(tMma *env) { env->storage.runtime.EGTS_FLEET_ON = true; } @@ -36,6 +37,7 @@ void TELEMATICA_STOP(tMma *env) { } } + #endif @@ -249,7 +251,7 @@ void Mma_EcallPrepare(tMma *env) { GsmWithGnss_SelectStandartNetwork(&env->gsmWithGnss.gsmAt, 25); SystemDelayMs(3000); AtGsm_OperatorSelectionDeregister(&env->gsmWithGnss.gsmAt); - AtGsmTelitLe910_GnssEcallOnlyMode(&env->gsmWithGnss.gsmAt,0); + AtGsmTelitLe910_GnssEcallOnlyMode(&env->gsmWithGnss.gsmAt, 0); } void Mma_EcallManual(tMma *env) { @@ -273,7 +275,7 @@ void Mma_EcallManualKZ(tMma *env) { Mma_SetMode(env, DEVICE_MODE_UVEOS_CALL_INITIATE); Mma_NetworkAndAudioRequireKz(env); Mma_EcallPrepare(env); - GsmWithGnss_NetworkEnableInnaterups(&env->gsmWithGnss, 5,250000); + GsmWithGnss_NetworkEnableInnaterups(&env->gsmWithGnss, 5, 250000); GpioPinEnable(&env->power.pins->main.ecall); env->uveos.currentMsd->msd.MSD_Data.msgId = 1; EraGlonassUveos_ManualEmergencyCall(&env->uveos, true); @@ -324,7 +326,7 @@ void Mma_EcallAutomatic(tMma *env, tUveosEmergencyEvent emergencyEvent) { Pwm_AudioEnable(&env->power); Mma_SetMode(env, DEVICE_MODE_UVEOS_CALL_INITIATE); Mma_EcallPrepare(env); - GsmWithGnss_NetworkEnableInnaterups(&env->gsmWithGnss, 5,250000); + GsmWithGnss_NetworkEnableInnaterups(&env->gsmWithGnss, 5, 250000); Mma_NetworkAndAudioRequireKz(env); GpioPinEnable(&env->power.pins->main.ecall); @@ -536,25 +538,23 @@ static _Noreturn void Mma_Thread(tMma *env) { } else { LoggerInfoStatic(LOGGER, LOG_SIGN, "Сеть или сим-чип отсутствует"); } - } else { - -#ifdef UVEOS_ADD_TELEMATICA - TELEMATICA_START(env); -#endif - } -/* Pwm_AudioDisable(&env->power); LoggerTraceStatic(LOGGER, LOG_SIGN, "Звуковой усилитель отключён") AtGsm_OperatorSelectionDeregister(&env->gsmWithGnss.gsmAt); SystemDelayMs(2000); - AtGsmTelitLe910_GnssEcallOnlyMode(&env->gsmWithGnss.gsmAt,0); + AtGsmTelitLe910_GnssEcallOnlyMode(&env->gsmWithGnss.gsmAt, 0); SystemDelayMs(2000); GsmWithGnss_SelectStandartNetwork(&env->gsmWithGnss.gsmAt, 25); + +#ifdef UVEOS_ADD_TELEMATICA + if (noSendMsdCount == 0) { + TELEMATICA_START(env); + } +#endif + // Mma_StartTestThreadStart(env); -*/ - SystemDelayMs(100); for (;;) { @@ -566,8 +566,8 @@ static _Noreturn void Mma_Thread(tMma *env) { } else { indicationState = GsmWithGnss_IsGnssReady(&env->gsmWithGnss) ? - DEVICE_MODE_UVEOS_ERA_GNSS_READY : - DEVICE_MODE_UVEOS_ERA_WAIT_GNSS; + DEVICE_MODE_UVEOS_ERA_GNSS_READY : + DEVICE_MODE_UVEOS_ERA_WAIT_GNSS; if (osMutexAcquire(env->gsmWithGnss.gsmAt.access, 1000) == osOK) { AtGsm_Gsnss_GetNMEA_Pack(&env->gsmWithGnss, 400); @@ -600,16 +600,16 @@ static _Noreturn void Mma_Thread(tMma *env) { #endif #ifndef UVEOS_ADD_TELEMATICA - LoggerTraceStatic(LOGGER, LOG_SIGN, "Начало итерации главного цикла") - LoggerTraceStatic(LOGGER, LOG_SIGN, "Проверяем нужна ли сеть...") + LoggerTraceStatic(LOGGER, LOG_SIGN, "Начало итерации главного цикла") + LoggerTraceStatic(LOGGER, LOG_SIGN, "Проверяем нужна ли сеть...") - if (EraGlonassUveos_IsRequireNetwork(&env->uveos)) { - LoggerTraceStatic(LOGGER, LOG_SIGN, "Нужна, подключаемся") - Mma_SetNetworkRegistration(env, true); - } else { - LoggerTraceStatic(LOGGER, LOG_SIGN, "Ненужна, отключаемся") - Mma_SetNetworkRegistration(env, false); - } + if (EraGlonassUveos_IsRequireNetwork(&env->uveos)) { + LoggerTraceStatic(LOGGER, LOG_SIGN, "Нужна, подключаемся") + Mma_SetNetworkRegistration(env, true); + } else { + LoggerTraceStatic(LOGGER, LOG_SIGN, "Ненужна, отключаемся") + Mma_SetNetworkRegistration(env, false); + } #endif LoggerTraceStatic(LOGGER, LOG_SIGN, "Выполняем постоянный тест") @@ -657,12 +657,12 @@ static _Noreturn void Mma_Thread(tMma *env) { #endif #ifndef UVEOS_ADD_TELEMATICA - checkLastInMemTransmit(env); + checkLastInMemTransmit(env); #endif LoggerTraceStatic(LOGGER, LOG_SIGN, "Проверяем экстренное событие") if (UveosEmergencyEvent_GetNext(&env->crashDetect.emergencyEvents, &emergencyEvent, 0)) { - if(env->storage.nvm.gost.CRASH_SIGNAL_INTERNAL == 1) { + if (env->storage.nvm.gost.CRASH_SIGNAL_INTERNAL == 1) { LoggerInfoStatic(LOGGER, LOG_SIGN, "Экстренное событие получено"); Mma_EcallAutomatic(env, emergencyEvent); } @@ -680,9 +680,7 @@ static _Noreturn void Mma_Thread(tMma *env) { TELEMATICA_STOP(env); #endif Mma_EcallManualKZ(env); - } else - - if (UserInputButtonEventIsBetween(buttonEvent, UI_BUTTON_ADDITIONAL, RAISE, 3000, 10000)) { + } else if (UserInputButtonEventIsBetween(buttonEvent, UI_BUTTON_ADDITIONAL, RAISE, 3000, 10000)) { #ifdef UVEOS_ADD_TELEMATICA TELEMATICA_STOP(env);