/* * Copyright (C) OpenTX * * Based on code named * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "opentx.h" uint8_t storageDirtyMsk; tmr10ms_t storageDirtyTime10ms; #if defined(RAMBACKUP) uint8_t rambackupDirtyMsk; tmr10ms_t rambackupDirtyTime10ms; #endif void storageDirty(uint8_t msk) { storageDirtyMsk |= msk; storageDirtyTime10ms = get_tmr10ms(); #if defined(RAMBACKUP) rambackupDirtyMsk = storageDirtyMsk; rambackupDirtyTime10ms = storageDirtyTime10ms; #endif } void preModelLoad() { watchdogSuspend(500/*5s*/); #if defined(SDCARD) logsClose(); #endif if (pulsesStarted()) { pausePulses(); } pauseMixerCalculations(); } #if defined(PCBTARANIS) || defined(PCBHORUS) static void fixUpModel() { // Ensure that when rfProtocol is RF_PROTO_OFF the type of the module is MODULE_TYPE_NONE if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT && g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF) g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE; } #endif void postModelLoad(bool alarms) { #if defined(PCBTARANIS) || defined(PCBHORUS) fixUpModel(); #endif AUDIO_FLUSH(); flightReset(false); customFunctionsReset(); restoreTimers(); for (int i=0; i