Init
This commit is contained in:
commit
3b26404b64
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 03.02.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_ANTTEST_H
|
||||||
|
#define UVEOS_ON_NATION_ANTTEST_H
|
||||||
|
#include "stdbool.h"
|
||||||
|
#include "AdcIO.h"
|
||||||
|
#include "AtCmdBase.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool *mode;
|
||||||
|
tAdcIO *externalAdc;
|
||||||
|
tAtCmd *gsmAt;
|
||||||
|
}tAntTest;
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_ANTTEST_H
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 30.10.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_DEVICETESTING_H
|
||||||
|
#define UVEOS_ON_NATION_DEVICETESTING_H
|
||||||
|
|
||||||
|
#include "DeviceTesting_Env.h"
|
||||||
|
|
||||||
|
bool DeviceTesting_OnIgnitionWithoutGsm(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_Periodical(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_OnIgnitionAfterGsm(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_Always(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_MainTestingMode(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_ManualTestMode(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_ChekExit(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_ExitTestMode(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_EcallKZ(tDeviceTesting *env);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_DEVICETESTING_H
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 18.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||||
|
#define UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||||
|
|
||||||
|
#include "DeviceTestsTable.h"
|
||||||
|
#include "GpioPinInterface.h"
|
||||||
|
#include "AtCmdCommon.h"
|
||||||
|
#include "AudioCodec.h"
|
||||||
|
#include "LoggerInterface.h"
|
||||||
|
#include "AudioPlayerInterface.h"
|
||||||
|
#include "AudioRecorderInterface.h"
|
||||||
|
#include "UserButtonsInterface.h"
|
||||||
|
#include "UserIndication.h"
|
||||||
|
#include "EraGlonassMsd.h"
|
||||||
|
#include "EraGlonassUveos.h"
|
||||||
|
#include "Adc.h"
|
||||||
|
#include "SpiPortIO.h"
|
||||||
|
#include "AccelDataFlowInterface.h"
|
||||||
|
#include "Accel.h"
|
||||||
|
#include "SpiPortNation.h"
|
||||||
|
#include "CmsisRtosThreadUtils.h"
|
||||||
|
#include "GsmWithGnss.h"
|
||||||
|
#include "AntTest.h"
|
||||||
|
#include "UserInputButtonWatcher.h"
|
||||||
|
|
||||||
|
#define DEVICE_TESTS_LIMIT (16)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
tMSD_DiagnosticResult tmsdDiagRes;
|
||||||
|
tTestDescriptor testsTableAlloc[DEVICE_TESTS_LIMIT];
|
||||||
|
tDeviceTestsTable testsTable;
|
||||||
|
tEraGlonassUveos *ErGlUv;
|
||||||
|
tLoggerInterface *logger;
|
||||||
|
tAudioPlayerInterface *audioPlayer;
|
||||||
|
tAudioRecorderInterface *audioRecorder;
|
||||||
|
tUserButtonsInterface *input;
|
||||||
|
tUserIndication *indication;
|
||||||
|
tGpioPin *pinIgnition;
|
||||||
|
tGpioPin *ringPin;
|
||||||
|
tAccelDataFlowInterface *accelDFI;
|
||||||
|
tUserInputButtonWatcher *UserInputButtonWatcher;
|
||||||
|
uint8_t indicationStatusRes;
|
||||||
|
uint8_t ignitionAddStatusRes;
|
||||||
|
uint8_t buttonAddStatusRes;
|
||||||
|
uint8_t ecallAddStatusRes;
|
||||||
|
#ifdef USE_GSM_AND_GNSS_TELIT
|
||||||
|
tGsmWithGnss *gsmWithGnss;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct {
|
||||||
|
tTestDescriptor *ignition;
|
||||||
|
tTestDescriptor *gnssAnt;
|
||||||
|
tTestDescriptor *speakConnect;
|
||||||
|
tTestDescriptor *batteryConn;
|
||||||
|
tTestDescriptor *batteryCharge;
|
||||||
|
tTestDescriptor *firmware;
|
||||||
|
tTestDescriptor *gsm;
|
||||||
|
tTestDescriptor *audioCodec;
|
||||||
|
tTestDescriptor *accel;
|
||||||
|
} namedTests;
|
||||||
|
|
||||||
|
tStaticThreadBlock(512) threadTest;
|
||||||
|
|
||||||
|
bool flagAutoTestSucsess;
|
||||||
|
uint8_t flagAcsessExitThread;
|
||||||
|
tAntTest antDiscript;
|
||||||
|
|
||||||
|
} tDeviceTesting;
|
||||||
|
|
||||||
|
bool DeviceTesting_Init(
|
||||||
|
tDeviceTesting *env,
|
||||||
|
|
||||||
|
tUserInputButtonWatcher *UserInputButtonWatcher,
|
||||||
|
tGpioPin *ignPin,
|
||||||
|
tAdcIO *gnssAntAdc,
|
||||||
|
tAdcIO *speakerAdc,
|
||||||
|
tAdcIO *batteryAdc,
|
||||||
|
tAccel *accel,
|
||||||
|
|
||||||
|
tGsmWithGnss *gsmWithGnss,
|
||||||
|
tAudioCodec *audioCodec,
|
||||||
|
tLoggerInterface *logger,
|
||||||
|
tAtCmd *gsm,
|
||||||
|
|
||||||
|
tAudioPlayerInterface *audioPlayer,
|
||||||
|
tAudioRecorderInterface *audioRecorder,
|
||||||
|
|
||||||
|
tUserButtonsInterface *input,
|
||||||
|
tUserIndication *indication,
|
||||||
|
|
||||||
|
tEraGlonassUveos *ErGlUv,
|
||||||
|
bool *antMode,
|
||||||
|
tGpioPin *ring
|
||||||
|
);
|
||||||
|
|
||||||
|
//ограничение воспроизведения одного семпла в 60с, можно увеличить до длительности большего семпла
|
||||||
|
#define DEVTST_PLAY_SAMPLE(SAMPLE) \
|
||||||
|
SystemDelayMs(40);\
|
||||||
|
AudioPlayer_PlayStatic(env->audioPlayer, SAMPLE, 4*1000);
|
||||||
|
|
||||||
|
//ограничение записи одного семпла в 60с, можно увеличить до длительности большего семпла
|
||||||
|
#define DEVTST_REC_SAMPLE(SAMPLE) \
|
||||||
|
SystemDelayMs(40);\
|
||||||
|
AudioRecord_RecStatic(env->audioRecorder, SAMPLE, 8*1000);
|
||||||
|
|
||||||
|
//#define DEVTST_GET_MAIN(NAME) DeviceTestsTable_GetModeTestStatic(&env->testsTable, DEVICE_TESTING_MODE_MAIN, NAME);
|
||||||
|
|
||||||
|
//Return IF Error (RIFE) - Выйти в случае ошибки
|
||||||
|
#define DEVICE_TESTING_RIFE(FUNC) {bool result = FUNC; if(!result){ return result;}}
|
||||||
|
|
||||||
|
//Битовые флаги режимов тестирования (константы с локальной видимостью)
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM = 0b1 << 0;
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_IGNITION_AFTER_GSM = 0b1 << 1;
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_ALWAYS = 0b1 << 2;
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_PERIODICAL = 0b1 << 3;
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_MAIN = 0b1 << 4;
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_ALL = 0xFFFF;
|
||||||
|
|
||||||
|
static const uint16_t DEVICE_TESTING_MODE_NOT_ALWAYS =
|
||||||
|
DEVICE_TESTING_MODE_ALL
|
||||||
|
& ~DEVICE_TESTING_MODE_ALWAYS
|
||||||
|
& ~DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
& ~DEVICE_TESTING_MODE_IGNITION_AFTER_GSM;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool DeviceTests_InitTestsTable(
|
||||||
|
tDeviceTesting *env,
|
||||||
|
tGpioPin *ignitionPin,
|
||||||
|
tAdcIO *speakerAdc,
|
||||||
|
tAdcIO *batteryAdc,
|
||||||
|
|
||||||
|
tAtCmd *gsm,
|
||||||
|
tAudioCodec *audioCodec,
|
||||||
|
tAccel *accel,
|
||||||
|
tAntTest *antCheck
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 18.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_DEVICETESTS_TESTINGMETHODS_H
|
||||||
|
#define UVEOS_ON_NATION_DEVICETESTS_TESTINGMETHODS_H
|
||||||
|
|
||||||
|
#include "DeviceTesting_Env.h"
|
||||||
|
#include "AntTest.h"
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AntTest(tAntTest *antTest);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcSpeakerTest(tAdcIO *speakerAdc);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcBatteryConnectionTest(tAdcIO *batteryAdc);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcBatteryChargeTest(tAdcIO *batteryAdc);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_PinTest(tGpioPin *gpioPin);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAt(tAtCmd *atCmd);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAudioCodec(tAudioCodec *audioCodec);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAccel(tAccel *accel);
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_JustOk(void *nil);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_DEVICETESTS_TESTINGMETHODS_H
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 18.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_DEVICETESTING_MAINTESTS_H
|
||||||
|
#define UVEOS_ON_NATION_DEVICETESTING_MAINTESTS_H
|
||||||
|
|
||||||
|
#include "DeviceTesting_Env.h"
|
||||||
|
|
||||||
|
bool DeviceTesting_TestAudioSpeaker(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_Ignition(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_Indication(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_Buttons(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_TestMic(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_WaitTestResult(tTestDescriptor *test, uint16_t value, uint32_t timeout);
|
||||||
|
|
||||||
|
bool DeviceTesting_UserGetResult(tDeviceTesting *env);
|
||||||
|
|
||||||
|
bool DeviceTesting_RunUserTests(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_Ecall(tDeviceTesting *env);
|
||||||
|
void DeviceTesting_EcallKZ(tDeviceTesting *env);
|
||||||
|
void DeviceTesting_EcallKZ1(tDeviceTesting *env);
|
||||||
|
void DeviceTesting_GetEcalRes(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_ExitTestPlay(tDeviceTesting *env);
|
||||||
|
|
||||||
|
void DeviceTesting_StartTestThread(tDeviceTesting *env);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_DEVICETESTING_MAINTESTS_H
|
||||||
|
|
@ -0,0 +1,389 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 30.10.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <AudioPlayerInterface.h>
|
||||||
|
#include <SystemDelayInterface.h>
|
||||||
|
#include "DeviceTesting.h"
|
||||||
|
#include "UserInput.h"
|
||||||
|
#include "DeviceTesting_TestsWithUser.h"
|
||||||
|
#include "Adc.h"
|
||||||
|
#include "EraGlonassMsd.h"
|
||||||
|
#include "EraGlonassUveos.h"
|
||||||
|
#include "Accel.h"
|
||||||
|
#include "GsmWithGnss.h"
|
||||||
|
#include "AsciiStringAssmeblingUtils.h"
|
||||||
|
|
||||||
|
#define LOGGER env->logger
|
||||||
|
#define LOG_SIGN "Тест."
|
||||||
|
|
||||||
|
bool DeviceTesting_Init(
|
||||||
|
tDeviceTesting *env,
|
||||||
|
|
||||||
|
tUserInputButtonWatcher *UserInputButtonWatcher,
|
||||||
|
tGpioPin *ignPin,
|
||||||
|
tAdcIO *gnssAntAdc,
|
||||||
|
tAdcIO *speakerAdc,
|
||||||
|
tAdcIO *batteryAdc,
|
||||||
|
tAccel *accel,
|
||||||
|
|
||||||
|
tGsmWithGnss *gsmWithGnss,
|
||||||
|
tAudioCodec *audioCodec,
|
||||||
|
tLoggerInterface *logger,
|
||||||
|
tAtCmd *gsm,
|
||||||
|
|
||||||
|
tAudioPlayerInterface *audioPlayer,
|
||||||
|
tAudioRecorderInterface *audioRecorder,
|
||||||
|
|
||||||
|
tUserButtonsInterface *input,
|
||||||
|
tUserIndication *indication,
|
||||||
|
|
||||||
|
tEraGlonassUveos *ErGlUv,
|
||||||
|
bool *antMode,
|
||||||
|
tGpioPin *ring
|
||||||
|
) {
|
||||||
|
env->UserInputButtonWatcher = UserInputButtonWatcher;
|
||||||
|
env->logger = logger;
|
||||||
|
env->audioPlayer = audioPlayer;
|
||||||
|
env->audioRecorder = audioRecorder;
|
||||||
|
env->input = input;
|
||||||
|
env->indication = indication;
|
||||||
|
env->ErGlUv = ErGlUv;
|
||||||
|
env->accelDFI = &accel->accelDataFlow;
|
||||||
|
env->pinIgnition = ignPin;
|
||||||
|
env->ringPin = ring;
|
||||||
|
env->antDiscript.externalAdc = gnssAntAdc;
|
||||||
|
env->antDiscript.gsmAt = gsm;
|
||||||
|
env->antDiscript.mode = antMode;
|
||||||
|
env->gsmWithGnss = gsmWithGnss;
|
||||||
|
DeviceTests_InitTestsTable(env, ignPin, speakerAdc, batteryAdc, gsm, audioCodec, accel, &env->antDiscript);
|
||||||
|
|
||||||
|
InitThreadAtrStatic(&env->threadTest.attr, "Thread_Test", env->threadTest.controlBlock,
|
||||||
|
env->threadTest.stack, osPriorityNormal);
|
||||||
|
|
||||||
|
env->flagAutoTestSucsess = false;
|
||||||
|
env->flagAcsessExitThread = (uint8_t)1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceTesting_StartTestThread(tDeviceTesting *env) {
|
||||||
|
if (!env->threadTest.id) {
|
||||||
|
env->threadTest.id = osThreadNew(
|
||||||
|
(osThreadFunc_t) (DeviceTesting_ManualTestMode),
|
||||||
|
(void *) (env),
|
||||||
|
&env->threadTest.attr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_ExitTestMode(tDeviceTesting *env) {
|
||||||
|
if (osThreadTerminate(env->threadTest.id) == osOK) {
|
||||||
|
osDelay(2000);
|
||||||
|
env->threadTest.id = NULL;
|
||||||
|
env->flagAcsessExitThread = (uint8_t)1;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ChekExit(tDeviceTesting *env) {
|
||||||
|
AtGsm_Gsnss_GetNMEA_Pack(env->gsmWithGnss, 1000);
|
||||||
|
SystemDelayMs(100);
|
||||||
|
EraGlonassUveos_DoNothingModeDistance(env->ErGlUv, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_RunUserTests(tDeviceTesting *env) {
|
||||||
|
|
||||||
|
DeviceTesting_StartTestThread(env);
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
|
||||||
|
if (EraGlonassUveos_IsAllowInCall(env->ErGlUv) && GpioPinGet(env->ringPin)) {
|
||||||
|
if (DeviceTesting_ExitTestMode(env)) {
|
||||||
|
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GpioPinGet(env->pinIgnition) && (env->flagAcsessExitThread == 1)) {
|
||||||
|
if (DeviceTesting_ExitTestMode(env)) {
|
||||||
|
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->flagAcsessExitThread == 2) {
|
||||||
|
if (DeviceTesting_ExitTestMode(env)) {
|
||||||
|
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->ErGlUv->doNothing.mode == UVEOS_DO_NOTHING_DISABLED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматический выход из режима пользовательского тестирования")
|
||||||
|
if (DeviceTesting_ExitTestMode(env)) {
|
||||||
|
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemDelayMs(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ManualTestMode(tDeviceTesting *env) {
|
||||||
|
//запускаем режим тестирования с пользователем
|
||||||
|
DeviceTesting_MainTestingMode(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
bool DeviceTesting_OnIgnitionWithoutGsm(tDeviceTesting *env) {
|
||||||
|
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM, 0);
|
||||||
|
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
bool DeviceTesting_OnIgnitionAfterGsm(tDeviceTesting *env) {
|
||||||
|
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_IGNITION_AFTER_GSM, 0);
|
||||||
|
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
bool DeviceTesting_Always(tDeviceTesting *env) {
|
||||||
|
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_ALWAYS, 0);
|
||||||
|
//
|
||||||
|
if ((DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR)) ||
|
||||||
|
(DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_NOT_CONNECTED)) ||
|
||||||
|
(DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_SHORT_CIRCUIT))
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
bool DeviceTesting_Main(tDeviceTesting *env) {
|
||||||
|
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_MAIN, 0);
|
||||||
|
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
bool DeviceTesting_Periodical(tDeviceTesting *env) {
|
||||||
|
if (!env->testsTable.currentProcessIterationsLeft) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
--env->testsTable.currentProcessIterationsLeft;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Режим самотестирования")
|
||||||
|
SystemDelayMs(5000);
|
||||||
|
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_PERIODICAL, 1000);
|
||||||
|
bool errors = DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||||
|
|
||||||
|
if (errors) {
|
||||||
|
for (uint16_t testIdx = 0; testIdx < env->testsTable.count; ++testIdx) {
|
||||||
|
tTestDescriptor *test = env->testsTable.items + testIdx;
|
||||||
|
|
||||||
|
if (test->result == DEVICE_TESTING_CODE_ERROR) {
|
||||||
|
LoggerCnErrorStatic(LOGGER, LOG_SIGN, "Тест ")
|
||||||
|
LoggerCnError(LOGGER, LOG_SIGN, test->name.str, test->name.length)
|
||||||
|
LoggerErrorStatic(LOGGER, LOG_SIGN, " не пройден")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Все тесты пройдены")
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_UserTests(tDeviceTesting *env) {
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
EraGlonassMsd_ClearDiagnostic(&env->tmsdDiagRes);
|
||||||
|
//задаем режим и обновляем индикторы
|
||||||
|
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||||
|
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.speakersFailure, DeviceTesting_TestAudioSpeaker(env));
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.ignitionLineFailure, DeviceTesting_Ignition(env));
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.micFailure, DeviceTesting_TestMic(env));
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.uimFailure, DeviceTesting_Buttons(env));
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
//выключаем индикацию
|
||||||
|
UserIndication_StopThread(env->indication);
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.statusIndicatorFailure, DeviceTesting_Indication(env));
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
//включаем индикацию
|
||||||
|
UserIndication_StartThread(env->indication);
|
||||||
|
return DeviceTesting_UserGetResult(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceTesting_AudioSysTestOk(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(100);
|
||||||
|
DEVTST_PLAY_SAMPLE("func")
|
||||||
|
DEVTST_PLAY_SAMPLE("regularly")
|
||||||
|
if (!env->flagAutoTestSucsess) {
|
||||||
|
env->flagAutoTestSucsess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_AudioSysTestErr(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(100);
|
||||||
|
DEVTST_PLAY_SAMPLE("func")
|
||||||
|
DEVTST_PLAY_SAMPLE("no")
|
||||||
|
DEVTST_PLAY_SAMPLE("regularly")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceTesting_GetSystemTest(tDeviceTesting *env) {
|
||||||
|
if (DeviceTestsTable_MakeTest(env->namedTests.firmware) == DEVICE_TESTING_CODE_PASSED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование целостности ПО, вызванное пользователем прошло успешно")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.firmwareImageCorruption, false);
|
||||||
|
DEVTST_PLAY_SAMPLE("ks_right")
|
||||||
|
// DEVTST_PLAY_SAMPLE("po")
|
||||||
|
// DEVTST_PLAY_SAMPLE("no")
|
||||||
|
// DEVTST_PLAY_SAMPLE("violated")
|
||||||
|
if (!env->flagAutoTestSucsess) {
|
||||||
|
env->flagAutoTestSucsess = true;
|
||||||
|
}
|
||||||
|
// } else {
|
||||||
|
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при автоматическом тестировании целостности ПО")
|
||||||
|
// DEVTST_PLAY_SAMPLE("ks_mistake")
|
||||||
|
// DEVTST_PLAY_SAMPLE("integrity")
|
||||||
|
// DEVTST_PLAY_SAMPLE("po")
|
||||||
|
// DEVTST_PLAY_SAMPLE("no")
|
||||||
|
// DEVTST_PLAY_SAMPLE("violated")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTestsTable_MakeTest(env->namedTests.gsm) != DEVICE_TESTING_CODE_PASSED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка модема при автоматическом тестировании пользователем")
|
||||||
|
DEVTST_PLAY_SAMPLE("modem")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.commModuleFailure, true);
|
||||||
|
DeviceTesting_AudioSysTestErr(env);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование модема, вызванное пользователем прошло успешно")
|
||||||
|
DEVTST_PLAY_SAMPLE("modem")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.commModuleFailure, false);
|
||||||
|
DeviceTesting_AudioSysTestOk(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTestsTable_MakeTest(env->namedTests.accel) == DEVICE_TESTING_CODE_PASSED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование акселеромерта, вызванное пользователем прошло успешно")
|
||||||
|
DEVTST_PLAY_SAMPLE("axel")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.crashSensorFailure, false);
|
||||||
|
DeviceTesting_AudioSysTestOk(env);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка акселеромерта при автоматическом тестировании пользователем")
|
||||||
|
DEVTST_PLAY_SAMPLE("axel")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.crashSensorFailure, true);
|
||||||
|
DeviceTesting_AudioSysTestErr(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTestsTable_MakeTest(env->namedTests.batteryCharge) != DEVICE_TESTING_CODE_ERROR) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование АКБ, вызванное пользователем прошло успешно")
|
||||||
|
DEVTST_PLAY_SAMPLE("akb")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.batteryFailure, false);
|
||||||
|
DeviceTesting_AudioSysTestOk(env);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка АКБ при автоматическом тестировании пользователем")
|
||||||
|
DEVTST_PLAY_SAMPLE("akb")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.batteryFailure, true);
|
||||||
|
DeviceTesting_AudioSysTestErr(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(DeviceTestsTable_MakeTest(env->namedTests.gnssAnt) == DEVICE_TESTING_CODE_CONNECTED)||
|
||||||
|
(DeviceTestsTable_MakeTest(env->namedTests.gnssAnt) == DEVICE_TESTING_CODE_INPUT_ANTENA_OK)
|
||||||
|
) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование антены, вызванное пользователем прошло успешно")
|
||||||
|
DEVTST_PLAY_SAMPLE("antenna")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.gnssAntennaFailure, false);
|
||||||
|
DeviceTesting_AudioSysTestOk(env);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка антены при автоматическом тестировании пользователем")
|
||||||
|
DEVTST_PLAY_SAMPLE("antenna")
|
||||||
|
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.gnssAntennaFailure, true);
|
||||||
|
DeviceTesting_AudioSysTestErr(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTestsTable_MakeTest(env->namedTests.audioCodec) == DEVICE_TESTING_CODE_PASSED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование аудиотракта, вызванное пользователем прошло успешно")
|
||||||
|
DEVTST_PLAY_SAMPLE("auditract")
|
||||||
|
DeviceTesting_AudioSysTestOk(env);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка аудиотракта при автоматическом тестировании пользователем")
|
||||||
|
DEVTST_PLAY_SAMPLE("auditract")
|
||||||
|
DeviceTesting_AudioSysTestErr(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//возвращает true в случае ошибки
|
||||||
|
void DeviceTesting_MainTestingMode(tDeviceTesting *env) {
|
||||||
|
UserIndication_Uiu(env->indication, UIU_OFF);
|
||||||
|
|
||||||
|
UserButtons_Clear(env->input);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Начало пользовательского тестирования")
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("switching-to")
|
||||||
|
DEVTST_PLAY_SAMPLE("mode")
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
|
||||||
|
bool userTestsOk = DeviceTesting_UserTests(env);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Выполняются внутренние тесты")
|
||||||
|
DeviceTesting_GetSystemTest(env);
|
||||||
|
if (env->flagAutoTestSucsess) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Внутренние тесты завершены успешно")
|
||||||
|
}
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
if (userTestsOk && !env->flagAutoTestSucsess) {
|
||||||
|
SystemDelayMs(500);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка внутреннего теста")
|
||||||
|
DEVTST_PLAY_SAMPLE("bug_internal_testing")
|
||||||
|
}
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
if (userTestsOk && env->flagAutoTestSucsess) {
|
||||||
|
if (!DeviceTesting_Main(env)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Все тесты пройдены успешно")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("exit_good")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
UserInputButtonWatcher_Clear(env->UserInputButtonWatcher);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Начало тестирования вызова с передачей данных с результатами проверки")
|
||||||
|
|
||||||
|
SystemDelayMs(2000);
|
||||||
|
DeviceTesting_Ecall(env);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестовый вызов пройден")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Формируется голосовой отчёт по тестовому вызову")
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
DeviceTesting_GetEcalRes(env);
|
||||||
|
|
||||||
|
if(env->ecallAddStatusRes == 1){
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Выполняются вызов оператору 112")
|
||||||
|
env->ErGlUv->currentMsd->msd.MSD_Data.msgId = 1;
|
||||||
|
EraGlonassUveos_ManualEmergencyCall(env->ErGlUv, false);
|
||||||
|
}
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Голосовой отчёт по тестовому вызову выполнен")
|
||||||
|
|
||||||
|
env->flagAcsessExitThread = (uint8_t) 2;
|
||||||
|
uint32_t time = SystemGetMs() + 20000;
|
||||||
|
while (1) {
|
||||||
|
if(time < SystemGetMs()){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
SystemDelayMs(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 18.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DeviceTesting_Env.h"
|
||||||
|
#include "DeviceTesting_TestingMethods.h"
|
||||||
|
#include "SpiPortIO.h"
|
||||||
|
#include "Accel.h"
|
||||||
|
#include "SpiPortNation.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define DEVICE_TESTING_ADD_TEST(NAME, TEST_ENV, TEST_METHOD, MODES) \
|
||||||
|
DeviceTestsTableAdd( \
|
||||||
|
&env->testsTable, \
|
||||||
|
DEVICE_TEST_NAME(NAME), \
|
||||||
|
TEST_ENV, \
|
||||||
|
(TestMethod) (TEST_METHOD), \
|
||||||
|
MODES \
|
||||||
|
) \
|
||||||
|
|
||||||
|
|
||||||
|
bool DeviceTests_InitTestsTable(
|
||||||
|
tDeviceTesting *env,
|
||||||
|
tGpioPin *ignitionPin,
|
||||||
|
tAdcIO *speakerAdc,
|
||||||
|
tAdcIO *batteryAdc,
|
||||||
|
|
||||||
|
tAtCmd *gsm,
|
||||||
|
tAudioCodec *audioCodec,
|
||||||
|
tAccel *accel,
|
||||||
|
tAntTest *antCheck
|
||||||
|
) {
|
||||||
|
|
||||||
|
DeviceTestsTableInitStatic(
|
||||||
|
&env->testsTable,
|
||||||
|
env->testsTableAlloc
|
||||||
|
);
|
||||||
|
|
||||||
|
env->namedTests.firmware = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"FIRMWARE", NULL, DeviceTesting_JustOk,
|
||||||
|
DEVICE_TESTING_MODE_NOT_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
env->namedTests.ignition = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"IGNITION",
|
||||||
|
ignitionPin,
|
||||||
|
DeviceTesting_PinTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
env->namedTests.batteryConn = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"BAT_CONNECT",
|
||||||
|
batteryAdc,
|
||||||
|
DeviceTesting_AdcBatteryConnectionTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_PERIODICAL |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
env->namedTests.batteryCharge = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"BAT_CHARGE",
|
||||||
|
batteryAdc,
|
||||||
|
DeviceTesting_AdcBatteryChargeTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_PERIODICAL |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
if (antCheck->mode == false) {
|
||||||
|
env->namedTests.gnssAnt = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"GNSS_ANT",
|
||||||
|
antCheck,
|
||||||
|
DeviceTesting_AntTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_PERIODICAL |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
env->namedTests.gnssAnt = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"GNSS_ANT",
|
||||||
|
antCheck,
|
||||||
|
DeviceTesting_AntTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_PERIODICAL |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
env->namedTests.speakConnect = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"SPEAKER_CONNECT",
|
||||||
|
speakerAdc,
|
||||||
|
DeviceTesting_AdcSpeakerTest,
|
||||||
|
DEVICE_TESTING_MODE_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_PERIODICAL |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
env->namedTests.accel = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"ACCEL", accel, DeviceTesting_TestAccel,
|
||||||
|
DEVICE_TESTING_MODE_NOT_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
env->namedTests.gsm = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"GSM", gsm, DeviceTesting_TestAt,
|
||||||
|
DEVICE_TESTING_MODE_NOT_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
env->namedTests.audioCodec = DEVICE_TESTING_ADD_TEST(
|
||||||
|
"AUDIO_CODEC", audioCodec, DeviceTesting_TestAudioCodec,
|
||||||
|
DEVICE_TESTING_MODE_NOT_ALWAYS |
|
||||||
|
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 18.11.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "DeviceTesting_TestingMethods.h"
|
||||||
|
#include "AtGsmTelitLe910_Gnss.h"
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AntTest(tAntTest *antTest) {
|
||||||
|
|
||||||
|
if (*antTest->mode == false) {
|
||||||
|
uint32_t sum = 0;
|
||||||
|
uint32_t data[3];
|
||||||
|
AdcGet(antTest->externalAdc, 1000);
|
||||||
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
|
data[i] = AdcGet(antTest->externalAdc, 1000);
|
||||||
|
}
|
||||||
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
|
sum += data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t statusAntAdcConvertedValue = sum / sizeof(data);
|
||||||
|
if (statusAntAdcConvertedValue < 50) {
|
||||||
|
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusAntAdcConvertedValue > 1000) {
|
||||||
|
return DEVICE_TESTING_CODE_SHORT_CIRCUIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEVICE_TESTING_CODE_CONNECTED;
|
||||||
|
} else {
|
||||||
|
return DEVICE_TESTING_CODE_INPUT_ANTENA_OK;
|
||||||
|
// eTelitLe910_ExternalLnaSupportMode extAntState = 0;
|
||||||
|
//
|
||||||
|
// if (AtGsmTelitLe910_Gnss_GetExternalLnaSupport(antTest->gsmAt, &extAntState) == AT_OK) {
|
||||||
|
//
|
||||||
|
// if (extAntState == TELIT_LE910_EXTERNAL_LNA_NOT_SUPPORT) {
|
||||||
|
// return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||||
|
// } else {
|
||||||
|
// return DEVICE_TESTING_CODE_INPUT_ANTENA_OK;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcSpeakerTest(tAdcIO *speakerAdc) {
|
||||||
|
uint16_t statusSpeakerAdcConvertedValue = AdcGet(speakerAdc, 1000);
|
||||||
|
|
||||||
|
if (statusSpeakerAdcConvertedValue < 1000) {
|
||||||
|
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEVICE_TESTING_CODE_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcBatteryConnectionTest(tAdcIO *batteryAdc) {
|
||||||
|
static const tries = 10;
|
||||||
|
|
||||||
|
uint64_t batVoltage = 0;
|
||||||
|
for (uint8_t try = 0; try < tries; try++) {
|
||||||
|
uint16_t single = AdcGet(batteryAdc, 1000);
|
||||||
|
batVoltage += single;
|
||||||
|
}
|
||||||
|
batVoltage /= tries;
|
||||||
|
|
||||||
|
// uint16_t batVoltage = AdcGet(batteryAdc, 1000);
|
||||||
|
|
||||||
|
if (batVoltage < 1000) {
|
||||||
|
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEVICE_TESTING_CODE_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_AdcBatteryChargeTest(tAdcIO *batteryAdc) {
|
||||||
|
static const tries = 10;
|
||||||
|
|
||||||
|
uint64_t batVoltage = 0;
|
||||||
|
for (uint8_t try = 0; try < tries; try++) {
|
||||||
|
uint16_t single = AdcGet(batteryAdc, 1000);
|
||||||
|
batVoltage += single;
|
||||||
|
}
|
||||||
|
batVoltage /= tries;
|
||||||
|
|
||||||
|
|
||||||
|
if (batVoltage < 2400) {
|
||||||
|
return DEVICE_TESTING_CODE_ERROR;
|
||||||
|
} else if (batVoltage < 3900) {
|
||||||
|
return DEVICE_TESTING_CODE_BATTERY_PRE_CHARGE;
|
||||||
|
} else if (batVoltage < 4000) {
|
||||||
|
return DEVICE_TESTING_CODE_BATTERY_FAST_CHARGE;
|
||||||
|
} else if (batVoltage < 4500) {
|
||||||
|
return DEVICE_TESTING_CODE_BATTERY_CHARGE_DONE;
|
||||||
|
} else {
|
||||||
|
return DEVICE_TESTING_CODE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_PinTest(tGpioPin *gpioPin) {
|
||||||
|
return GpioPinGet(gpioPin) ? DEVICE_TESTING_CODE_CONNECTED : DEVICE_TESTING_CODE_NOT_CONNECTED_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAt(tAtCmd *atCmd) {
|
||||||
|
return AtCmd(atCmd) == AT_OK ? DEVICE_TESTING_CODE_PASSED : DEVICE_TESTING_CODE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAudioCodec(tAudioCodec *audioCodec) {
|
||||||
|
return AudioCodecTestStatus(audioCodec) ? DEVICE_TESTING_CODE_PASSED : DEVICE_TESTING_CODE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_TestAccel(tAccel *accel) {
|
||||||
|
if (!accel->errorDataFlag) {
|
||||||
|
return DEVICE_TESTING_CODE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// float len = vector3Len(accel->current);
|
||||||
|
//
|
||||||
|
// if ((len < 0.9) || (len > 1.1)) {
|
||||||
|
// return DEVICE_TESTING_CODE_ERROR;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return DEVICE_TESTING_CODE_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
eDeviceTestingCode DeviceTesting_JustOk(void *nil) {
|
||||||
|
return DEVICE_TESTING_CODE_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,609 @@
|
||||||
|
////
|
||||||
|
//// Created by xemon on 09.11.2021.
|
||||||
|
////
|
||||||
|
#include <SystemDelayInterface.h>
|
||||||
|
#include "DeviceTesting.h"
|
||||||
|
#include "UserInput.h"
|
||||||
|
#include "EraGlonassMsd.h"
|
||||||
|
#include "EraGlonassUveos.h"
|
||||||
|
|
||||||
|
#define LOGGER env->logger
|
||||||
|
#define LOG_SIGN "Тест. Пользв."
|
||||||
|
|
||||||
|
uint16_t timeoutPresButton = 10000;
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceTesting_ErorEmergencyPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("emergency")
|
||||||
|
DEVTST_PLAY_SAMPLE("call")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorEmergencyNumberNotSetPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("number")
|
||||||
|
DEVTST_PLAY_SAMPLE("call")
|
||||||
|
DEVTST_PLAY_SAMPLE("dont_set")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorEmergencyTempLocPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("execute")
|
||||||
|
DEVTST_PLAY_SAMPLE("call")
|
||||||
|
DEVTST_PLAY_SAMPLE("temp_imposible")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_EmergencySucsessPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("emergency")
|
||||||
|
DEVTST_PLAY_SAMPLE("call")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorAddButtonPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("buttom")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorSosButtonPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("buttom")
|
||||||
|
DEVTST_PLAY_SAMPLE("sos_call")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ButtonSuccessPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("buttom")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_IgnitionSucsessPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_IgnitionOffErrorPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("when_turned_off")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_IgnitionOnErrorPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("when_turned_on")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorGreenIndicationPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("green_ind")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorRedIndicationPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("red_ind")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_SucsessIndicationPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("indicators")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorMicPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("microphon")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_SucsessMicPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("microphon")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ErorSpeakerPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("error_testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("dinamics")
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_SucsessSpeakerPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(150);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("dinamics")
|
||||||
|
DEVTST_PLAY_SAMPLE("successfully")
|
||||||
|
DEVTST_PLAY_SAMPLE("done")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_WaitTestResult(tTestDescriptor *test, uint16_t value, uint32_t timeout) {
|
||||||
|
uint32_t end = SystemGetMs() + timeout;
|
||||||
|
while (SystemGetMs() < end) {
|
||||||
|
DeviceTestsTable_MakeTest(test);
|
||||||
|
if (test->result == value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SystemDelayMs(1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_ExitTestPlay(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(300);
|
||||||
|
DEVTST_PLAY_SAMPLE("exit_mode")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_WaitAddButtonClick(tDeviceTesting *env, uint32_t timeout) {
|
||||||
|
tUserInputButtonEvent buttonEvent;
|
||||||
|
uint32_t end = SystemGetMs() + timeout;
|
||||||
|
while (SystemGetMs() < end) {
|
||||||
|
UserButtons_Clear(env->input);
|
||||||
|
UserButtons_GetNext(env->input, &buttonEvent, timeout);
|
||||||
|
if (UserInputButtonEventIs(buttonEvent, UI_BUTTON_ADDITIONAL, FALL)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Нажата \"Доп.Функции\"")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SystemDelayMs(1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_WaitSosButtonClick(tDeviceTesting *env, uint32_t timeout) {
|
||||||
|
tUserInputButtonEvent buttonEvent;
|
||||||
|
uint32_t end = SystemGetMs() + timeout;
|
||||||
|
while (SystemGetMs() < end) {
|
||||||
|
UserButtons_Clear(env->input);
|
||||||
|
UserButtons_GetNext(env->input, &buttonEvent, timeout);
|
||||||
|
if (UserInputButtonEventIs(buttonEvent, UI_BUTTON_EMERGENCY, FALL)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Нажата \"SOS\"")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
SystemDelayMs(1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestAudioSpeaker(tDeviceTesting *env) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест динамика")
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("dinamics")
|
||||||
|
DEVTST_PLAY_SAMPLE("if_you_hear_massage")
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
if (!DeviceTesting_WaitAddButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DeviceTesting_TestMic(tDeviceTesting *env) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестирование микрофона")
|
||||||
|
// SystemDelayMs(200);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("microphon")
|
||||||
|
DEVTST_PLAY_SAMPLE("say_any")
|
||||||
|
DEVTST_REC_SAMPLE("test_rec_name")
|
||||||
|
SystemDelayMs(2000);
|
||||||
|
AudioPlayer_PlayStatic(env->audioPlayer, "test_rec_name", 85*1000);
|
||||||
|
SystemDelayMs(8000);
|
||||||
|
DEVTST_PLAY_SAMPLE("if_you_hear_recording")
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
|
||||||
|
if (!DeviceTesting_WaitAddButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_Ignition(tDeviceTesting *env) {
|
||||||
|
env->flagAcsessExitThread = (uint8_t) 0;
|
||||||
|
tTestDescriptor *currentTest;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест зажигания")
|
||||||
|
currentTest = DeviceTestsTable_GetModeTestStatic(&env->testsTable, DEVICE_TESTING_MODE_ALL, "IGNITION");
|
||||||
|
if (currentTest) {
|
||||||
|
bool res = false;
|
||||||
|
env->ignitionAddStatusRes = 0;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Запрос выключить зажигание")
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("turn_off")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
if (!DeviceTesting_WaitTestResult(currentTest, DEVICE_TESTING_CODE_NOT_CONNECTED_OK, 10000)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
env->ignitionAddStatusRes = 1;
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Запрос включить зажигание")
|
||||||
|
DEVTST_PLAY_SAMPLE("turn_on")
|
||||||
|
DEVTST_PLAY_SAMPLE("ignition")
|
||||||
|
if (!DeviceTesting_WaitTestResult(currentTest, DEVICE_TESTING_CODE_CONNECTED, 10000)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
env->ignitionAddStatusRes = 2;
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
if (env->ignitionAddStatusRes == 0 && res == false) {
|
||||||
|
env->ignitionAddStatusRes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemDelayMs(200);
|
||||||
|
env->flagAcsessExitThread = (uint8_t) 1;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
SystemDelayMs(200);
|
||||||
|
env->flagAcsessExitThread = (uint8_t) 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DeviceTesting_Indication(tDeviceTesting *env) {
|
||||||
|
bool res = false;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест индикатора")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Горит зеленый")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание подтверждения кнопкой доп. функций...")
|
||||||
|
|
||||||
|
UserIndication_Uiu(env->indication, UIU_GREEN);
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("indications")
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("if_indication_on")
|
||||||
|
DEVTST_PLAY_SAMPLE("green")
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
|
||||||
|
if (!DeviceTesting_WaitAddButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
env->indicationStatusRes = 1;
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест пройден")
|
||||||
|
}
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Горит красный")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание подтверждения кнопкой доп. функций...")
|
||||||
|
|
||||||
|
UserIndication_Uiu(env->indication, UIU_RED);
|
||||||
|
DEVTST_PLAY_SAMPLE("if_indication_on")
|
||||||
|
DEVTST_PLAY_SAMPLE("red")
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
|
||||||
|
if (!DeviceTesting_WaitAddButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
res = true;
|
||||||
|
if (env->indicationStatusRes == 0) {
|
||||||
|
env->indicationStatusRes = 2;
|
||||||
|
} else {
|
||||||
|
env->indicationStatusRes = 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
if (env->indicationStatusRes == 0 && res == false) {
|
||||||
|
env->indicationStatusRes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DeviceTesting_Buttons(tDeviceTesting *env) {
|
||||||
|
bool res = false;
|
||||||
|
env->buttonAddStatusRes = 0;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест кнопок")
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("buttom")
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("sos_call")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание нажатия кнопки экстренного вызова...")
|
||||||
|
if (!DeviceTesting_WaitSosButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
env->buttonAddStatusRes = 1;
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест пройден")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceTesting_ChekExit(env);
|
||||||
|
DEVTST_PLAY_SAMPLE("press_button")
|
||||||
|
DEVTST_PLAY_SAMPLE("add_functions")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание нажатия кнопки дополнительных функций...")
|
||||||
|
if (!DeviceTesting_WaitAddButtonClick(env, timeoutPresButton)) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
res = true;
|
||||||
|
if (env->buttonAddStatusRes == 0) {
|
||||||
|
env->buttonAddStatusRes = 2;
|
||||||
|
} else {
|
||||||
|
env->buttonAddStatusRes = 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("confirmed")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест пройден")
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
if (env->buttonAddStatusRes == 0 && res == false) {
|
||||||
|
env->buttonAddStatusRes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_EcallKZ1(tDeviceTesting *env) {
|
||||||
|
|
||||||
|
String16CopyStatic(&env->ErGlUv->settings->ECALL_TEST_NUMBER, "112");
|
||||||
|
env->ecallAddStatusRes = 0;
|
||||||
|
bool res = false;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест экстренного вызова")
|
||||||
|
|
||||||
|
eEraGlonassUveos_EcallProcessingResult resCall;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание выполнения теста экстренного вызова...")
|
||||||
|
resCall = EraGlonassUveos_TestEmergencyCall(env->ErGlUv, &env->tmsdDiagRes, false);
|
||||||
|
String16CopyStatic(&env->ErGlUv->settings->ECALL_TEST_NUMBER, "+79418100029");
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTesting_EcallKZ(tDeviceTesting *env) {
|
||||||
|
|
||||||
|
String16CopyStatic(&env->ErGlUv->settings->ECALL_TEST_NUMBER, "112");
|
||||||
|
env->ecallAddStatusRes = 0;
|
||||||
|
bool res = false;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест экстренного вызова")
|
||||||
|
|
||||||
|
eEraGlonassUveos_EcallProcessingResult resCall;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание выполнения теста экстренного вызова...")
|
||||||
|
resCall = EraGlonassUveos_TestEmergencyCall(env->ErGlUv, &env->tmsdDiagRes, true);
|
||||||
|
String16CopyStatic(&env->ErGlUv->settings->ECALL_TEST_NUMBER, "+79418100029");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_Ecall(tDeviceTesting *env) {
|
||||||
|
env->ecallAddStatusRes = 0;
|
||||||
|
bool res = false;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест экстренного вызова")
|
||||||
|
|
||||||
|
DEVTST_PLAY_SAMPLE("testing")
|
||||||
|
DEVTST_PLAY_SAMPLE("emergency")
|
||||||
|
DEVTST_PLAY_SAMPLE("call")
|
||||||
|
|
||||||
|
if (env->ErGlUv->settings->ECALL_TEST_NUMBER.length < 2) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
env->ecallAddStatusRes = 1;
|
||||||
|
res = false;
|
||||||
|
} else {
|
||||||
|
eEraGlonassUveos_EcallProcessingResult resCall;
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание выполнения теста экстренного вызова...")
|
||||||
|
resCall = EraGlonassUveos_TestEmergencyCall(env->ErGlUv, &env->tmsdDiagRes,true);
|
||||||
|
if (resCall == ERA_GLONASS_UVEOS_TEST_CALL_NOT_ALLOWED) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста")
|
||||||
|
DEVTST_PLAY_SAMPLE("error")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
env->ecallAddStatusRes = 2;
|
||||||
|
res = false;
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
res = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestIgnitionRes(tDeviceTesting *env) {
|
||||||
|
SystemDelayMs(200);
|
||||||
|
bool res = false;
|
||||||
|
if (env->tmsdDiagRes.ignitionLineFailure != 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест зажигания успешно выполнен")
|
||||||
|
DeviceTesting_IgnitionSucsessPlay(env);
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
if (env->ignitionAddStatusRes == 1) {
|
||||||
|
SystemDelayMs(200);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании отключения заигания")
|
||||||
|
DeviceTesting_IgnitionOffErrorPlay(env);
|
||||||
|
}
|
||||||
|
if (env->ignitionAddStatusRes == 2) {
|
||||||
|
SystemDelayMs(200);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании включения заигания")
|
||||||
|
DeviceTesting_IgnitionOnErrorPlay(env);
|
||||||
|
}
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestButtonRes(tDeviceTesting *env) {
|
||||||
|
bool res = false;
|
||||||
|
if (env->tmsdDiagRes.uimFailure != 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест кнопок успешно выполнен")
|
||||||
|
DeviceTesting_ButtonSuccessPlay(env);
|
||||||
|
SystemDelayMs(500);
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
if (env->buttonAddStatusRes == 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки экстренного вызова")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorSosButtonPlay(env);
|
||||||
|
}
|
||||||
|
if (env->buttonAddStatusRes == 2) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки дополнительный функций")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorAddButtonPlay(env);
|
||||||
|
}
|
||||||
|
if (env->buttonAddStatusRes == 3) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки дополнительный функций")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorSosButtonPlay(env);
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorAddButtonPlay(env);
|
||||||
|
}
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestAudioSpeakerRes(tDeviceTesting *env) {
|
||||||
|
if (env->tmsdDiagRes.speakersFailure == 1) {
|
||||||
|
DeviceTesting_ErorSpeakerPlay(env);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестирования динамика")
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест динамика успешно выполнен")
|
||||||
|
DeviceTesting_SucsessSpeakerPlay(env);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestMicRes(tDeviceTesting *env) {
|
||||||
|
if (env->tmsdDiagRes.micFailure != 1) {
|
||||||
|
SystemDelayMs(500);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест микрофона успешно выполнен")
|
||||||
|
DeviceTesting_SucsessMicPlay(env);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
SystemDelayMs(500);
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестирования микрофона")
|
||||||
|
DeviceTesting_ErorMicPlay(env);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_TestIndicationRes(tDeviceTesting *env) {
|
||||||
|
bool res = false;
|
||||||
|
if (env->tmsdDiagRes.statusIndicatorFailure != 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест индикаторов успешно выполнен")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_SucsessIndicationPlay(env);
|
||||||
|
res = true;
|
||||||
|
} else {
|
||||||
|
if (env->indicationStatusRes == 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании зелёного индикатора ")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorGreenIndicationPlay(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->indicationStatusRes == 2) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании красного индикатора ")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorRedIndicationPlay(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->indicationStatusRes == 3) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании индикации")
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorGreenIndicationPlay(env);
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorRedIndicationPlay(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceTesting_GetEcalRes(tDeviceTesting *env) {
|
||||||
|
if (env->ecallAddStatusRes == 0) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестирование вызова выполнено успешно")
|
||||||
|
DeviceTesting_EmergencySucsessPlay(env);
|
||||||
|
}
|
||||||
|
if (env->ecallAddStatusRes == 1) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Номер тестового вызова не установлен, вызов не возможен")
|
||||||
|
DeviceTesting_ErorEmergencyPlay(env);
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorEmergencyNumberNotSetPlay(env);
|
||||||
|
}
|
||||||
|
if (env->ecallAddStatusRes == 2) {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Превышен допустимый интервал, вызов не возможен, попробуйте позже")
|
||||||
|
DeviceTesting_ErorEmergencyPlay(env);
|
||||||
|
SystemDelayMs(500);
|
||||||
|
DeviceTesting_ErorEmergencyTempLocPlay(env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTesting_UserGetResult(tDeviceTesting *env) {
|
||||||
|
bool fullRes = true;
|
||||||
|
SystemDelayMs(1000);
|
||||||
|
if (DeviceTesting_TestAudioSpeakerRes(env) && fullRes) {
|
||||||
|
fullRes = true;
|
||||||
|
} else {
|
||||||
|
fullRes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTesting_TestMicRes(env) && fullRes) {
|
||||||
|
fullRes = true;
|
||||||
|
} else {
|
||||||
|
fullRes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTesting_TestIgnitionRes(env) && fullRes) {
|
||||||
|
fullRes = true;
|
||||||
|
} else {
|
||||||
|
fullRes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTesting_TestButtonRes(env) && fullRes) {
|
||||||
|
fullRes = true;
|
||||||
|
} else {
|
||||||
|
fullRes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceTesting_TestIndicationRes(env) && fullRes) {
|
||||||
|
fullRes = true;
|
||||||
|
} else {
|
||||||
|
fullRes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fullRes;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "XfcTransportProtocol"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "BaseTypes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "DeviceTestsTable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "AudioPlayerInterface"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "UserButtonsInterface"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"Inc"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"Src/**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue