1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

[Horus] SD Storage started. UI continued.

+ Some boyscout work on LCD functions
This commit is contained in:
Bertrand Songis 2015-10-22 07:09:53 +02:00
parent d353f3c388
commit c8f77fceec
270 changed files with 2403 additions and 2474 deletions

View file

@ -0,0 +1,129 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* 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 s_storageDirtyMsk;
tmr10ms_t s_storageDirtyTime10ms;
void storageDirty(uint8_t msk)
{
s_storageDirtyMsk |= msk;
s_storageDirtyTime10ms = get_tmr10ms() ;
}
void preModelLoad()
{
#if defined(CPUARM)
watchdogSetTimeout(500/*5s*/);
#endif
#if defined(SDCARD)
closeLogs();
#endif
if (pulsesStarted()) {
pausePulses();
}
pauseMixerCalculations();
}
void postModelLoad(bool newModel)
{
AUDIO_FLUSH();
flightReset();
logicalSwitchesReset();
if (pulsesStarted()) {
#if defined(GUI)
if (!newModel) {
checkAll();
}
#endif
resumePulses();
}
customFunctionsReset();
restoreTimers();
#if defined(CPUARM)
for (int i=0; i<MAX_SENSORS; i++) {
TelemetrySensor & sensor = g_model.telemetrySensors[i];
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent) {
telemetryItems[i].value = sensor.persistentValue;
}
}
#endif
LOAD_MODEL_CURVES();
resumeMixerCalculations();
// TODO pulses should be started after mixer calculations ...
#if defined(FRSKY)
frskySendAlarms();
#endif
#if defined(CPUARM) && defined(SDCARD)
referenceModelAudioFiles();
#endif
LOAD_MODEL_BITMAP();
LUA_LOAD_MODEL_SCRIPTS();
SEND_FAILSAFE_1S();
PLAY_MODEL_NAME();
}
void storageEraseAll(bool warn)
{
TRACE("storageEraseAll()");
generalDefault();
modelDefault(0);
if (warn) {
ALERT(STR_EEPROMWARN, STR_BADEEPROMDATA, AU_BAD_EEPROM);
}
MESSAGE(STR_EEPROMWARN, STR_EEPROMFORMATTING, NULL, AU_EEPROM_FORMATTING);
storageFormat();
storageDirty(EE_GENERAL);
storageDirty(EE_MODEL);
storageCheck(true);
}