1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 19:40:20 +03:00

RTOS refactoring + more AVR removal

This commit is contained in:
Bertrand Songis 2018-08-05 12:06:48 +02:00
parent f60733b561
commit f3bfde242b
80 changed files with 1111 additions and 1054 deletions

View file

@ -430,10 +430,12 @@ if(NOT MSVC)
# these are in addition to CMAKE_CXX_FLAGS # these are in addition to CMAKE_CXX_FLAGS
set(CMAKE_EXE_LINKER_FLAGS "-lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections") set(CMAKE_EXE_LINKER_FLAGS "-lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections")
if(SEMIHOSTING) if(SEMIHOSTING)
add_definitions(-DSEMIHOSTING) add_definitions(-DSEMIHOSTING)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
endif() endif()
# Use newlib nano, which saves a few kilobytes. # Use newlib nano, which saves a few kilobytes.
if(NOT NANO STREQUAL NO) if(NOT NANO STREQUAL NO)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs")
@ -446,7 +448,6 @@ if(NOT MSVC)
set(SRC ${SRC} bin_allocator.cpp) set(SRC ${SRC} bin_allocator.cpp)
endif() endif()
if(PCB STREQUAL XLITE OR PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X10 OR PCB STREQUAL X12S) if(PCB STREQUAL XLITE OR PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X10 OR PCB STREQUAL X12S)
add_subdirectory(targets/common/arm/stm32/bootloader) add_subdirectory(targets/common/arm/stm32/bootloader)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/common/arm/stm32/bootloader) include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/common/arm/stm32/bootloader)
@ -462,6 +463,8 @@ if(NOT MSVC)
endif() endif()
endif() endif()
add_definitions(-DRTOS_COOS)
add_executable(firmware ${SRC} ${FIRMWARE_HEADERS}) add_executable(firmware ${SRC} ${FIRMWARE_HEADERS})
link_libraries(firmware -lstdc++) link_libraries(firmware -lstdc++)
add_dependencies(firmware ${FIRMWARE_DEPENDENCIES}) add_dependencies(firmware ${FIRMWARE_DEPENDENCIES})

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
#include <math.h> #include <math.h>
extern OS_MutexID audioMutex; extern RTOS_MUTEX_HANDLE audioMutex;
const int16_t sineValues[] = const int16_t sineValues[] =
{ {
@ -508,14 +508,14 @@ AudioQueue::AudioQueue()
void audioTask(void * pdata) void audioTask(void * pdata)
{ {
while (!audioQueue.started()) { while (!audioQueue.started()) {
CoTickDelay(1); RTOS_WAIT_TICKS(1);
} }
setSampleRate(AUDIO_SAMPLE_RATE); setSampleRate(AUDIO_SAMPLE_RATE);
#if defined(PCBX12S) #if defined(PCBX12S)
// The audio amp needs ~2s to start // The audio amp needs ~2s to start
CoTickDelay(500); // 1s RTOS_WAIT_MS(1000); // 1s
#endif #endif
if (!unexpectedShutdown) { if (!unexpectedShutdown) {
@ -527,7 +527,7 @@ void audioTask(void * pdata)
DEBUG_TIMER_START(debugTimerAudioDuration); DEBUG_TIMER_START(debugTimerAudioDuration);
audioQueue.wakeup(); audioQueue.wakeup();
DEBUG_TIMER_STOP(debugTimerAudioDuration); DEBUG_TIMER_STOP(debugTimerAudioDuration);
CoTickDelay(2/*4ms*/); RTOS_WAIT_MS(4);
} }
} }
#endif #endif
@ -763,9 +763,9 @@ void AudioQueue::wakeup()
// mix the normal context (tones and wavs) // mix the normal context (tones and wavs)
if (normalContext.isEmpty() && !fragmentsFifo.empty()) { if (normalContext.isEmpty() && !fragmentsFifo.empty()) {
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
normalContext.setFragment(fragmentsFifo.get()); normalContext.setFragment(fragmentsFifo.get());
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
result = normalContext.mixBuffer(buffer, g_eeGeneral.beepVolume, g_eeGeneral.wavVolume, fade); result = normalContext.mixBuffer(buffer, g_eeGeneral.beepVolume, g_eeGeneral.wavVolume, fade);
if (result > 0) { if (result > 0) {
@ -848,7 +848,7 @@ void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t f
return; return;
#endif #endif
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
freq = limit<uint16_t>(BEEP_MIN_FREQ, freq, BEEP_MAX_FREQ); freq = limit<uint16_t>(BEEP_MIN_FREQ, freq, BEEP_MAX_FREQ);
@ -871,7 +871,7 @@ void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t f
} }
} }
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
#if defined(SDCARD) #if defined(SDCARD)
@ -899,7 +899,7 @@ void AudioQueue::playFile(const char * filename, uint8_t flags, uint8_t id)
return; return;
} }
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
if (flags & PLAY_BACKGROUND) { if (flags & PLAY_BACKGROUND) {
backgroundContext.clear(); backgroundContext.clear();
@ -909,7 +909,7 @@ void AudioQueue::playFile(const char * filename, uint8_t flags, uint8_t id)
fragmentsFifo.push(AudioFragment(filename, flags & 0x0f, id)); fragmentsFifo.push(AudioFragment(filename, flags & 0x0f, id));
} }
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
void AudioQueue::stopPlay(uint8_t id) void AudioQueue::stopPlay(uint8_t id)
@ -922,12 +922,12 @@ void AudioQueue::stopPlay(uint8_t id)
return; return;
#endif #endif
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
fragmentsFifo.removePromptById(id); fragmentsFifo.removePromptById(id);
backgroundContext.stop(id); backgroundContext.stop(id);
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
void AudioQueue::stopSD() void AudioQueue::stopSD()
@ -942,19 +942,19 @@ void AudioQueue::stopSD()
void AudioQueue::stopAll() void AudioQueue::stopAll()
{ {
flush(); flush();
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
priorityContext.clear(); priorityContext.clear();
normalContext.clear(); normalContext.clear();
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
void AudioQueue::flush() void AudioQueue::flush()
{ {
CoEnterMutexSection(audioMutex); RTOS_LOCK_MUTEX(audioMutex);
fragmentsFifo.clear(); fragmentsFifo.clear();
varioContext.clear(); varioContext.clear();
backgroundContext.clear(); backgroundContext.clear();
CoLeaveMutexSection(audioMutex); RTOS_UNLOCK_MUTEX(audioMutex);
} }
void audioPlay(unsigned int index, uint8_t id) void audioPlay(unsigned int index, uint8_t id)

View file

@ -28,7 +28,7 @@ bool warble = false;
bool warbleC; bool warbleC;
// The various "beep" tone lengths // The various "beep" tone lengths
static const pm_uint8_t beepTab[] PROGMEM = { static const pm_uint8_t beepTab[] = {
// key, trim, warn2, warn1, error // key, trim, warn2, warn1, error
1, 1, 2, 10, 60, //xShort 1, 1, 2, 10, 60, //xShort
1, 1, 4, 20, 80, //short 1, 1, 4, 20, 80, //short

View file

@ -308,7 +308,7 @@ int cliTestNew()
{ {
char * tmp = 0; char * tmp = 0;
serialPrint("Allocating 1kB with new()"); serialPrint("Allocating 1kB with new()");
CoTickDelay(100); RTOS_WAIT_MS(200);
tmp = new char[1024]; tmp = new char[1024];
if (tmp) { if (tmp) {
serialPrint("\tsuccess"); serialPrint("\tsuccess");
@ -320,7 +320,7 @@ int cliTestNew()
} }
serialPrint("Allocating 10MB with (std::nothrow) new()"); serialPrint("Allocating 10MB with (std::nothrow) new()");
CoTickDelay(100); RTOS_WAIT_MS(200);
tmp = new (std::nothrow) char[1024*1024*10]; tmp = new (std::nothrow) char[1024*1024*10];
if (tmp) { if (tmp) {
serialPrint("\tFAILURE, tmp = %p", tmp); serialPrint("\tFAILURE, tmp = %p", tmp);
@ -332,7 +332,7 @@ int cliTestNew()
} }
serialPrint("Allocating 10MB with new()"); serialPrint("Allocating 10MB with new()");
CoTickDelay(100); RTOS_WAIT_MS(200);
tmp = new char[1024*1024*10]; tmp = new char[1024*1024*10];
if (tmp) { if (tmp) {
serialPrint("\tFAILURE, tmp = %p", tmp); serialPrint("\tFAILURE, tmp = %p", tmp);
@ -437,14 +437,14 @@ float runGraphicsTest(graphichTestFunc func, const char * name, uint32_t runtime
uint32_t actualRuntime = (uint32_t)CoGetOSTime() - start; uint32_t actualRuntime = (uint32_t)CoGetOSTime() - start;
float result = (noRuns * 500.0f) / (float)actualRuntime; // runs/second float result = (noRuns * 500.0f) / (float)actualRuntime; // runs/second
serialPrint("Test %s speed: %0.2f, (%d runs in %d ms)", name, result, noRuns, actualRuntime*2); serialPrint("Test %s speed: %0.2f, (%d runs in %d ms)", name, result, noRuns, actualRuntime*2);
CoTickDelay(100); RTOS_WAIT_MS(200);
return result; return result;
} }
int cliTestGraphics() int cliTestGraphics()
{ {
serialPrint("Starting graphics performance test..."); serialPrint("Starting graphics performance test...");
CoTickDelay(100); RTOS_WAIT_MS(200);
watchdogSuspend(6000/*60s*/); watchdogSuspend(6000/*60s*/);
if (pulsesStarted()) { if (pulsesStarted()) {
@ -581,7 +581,7 @@ float runMemoryTest(graphichTestFunc func, const char * name, uint32_t runtime)
uint32_t actualRuntime = (uint32_t)CoGetOSTime() - start; uint32_t actualRuntime = (uint32_t)CoGetOSTime() - start;
float result = (noRuns * 500.0f) / (float)actualRuntime; // runs/second float result = (noRuns * 500.0f) / (float)actualRuntime; // runs/second
serialPrint("Test %s speed: %0.2f, (%d runs in %d ms)", name, result, noRuns, actualRuntime*2); serialPrint("Test %s speed: %0.2f, (%d runs in %d ms)", name, result, noRuns, actualRuntime*2);
CoTickDelay(100); RTOS_WAIT_MS(200);
return result; return result;
} }
@ -589,7 +589,7 @@ float runMemoryTest(graphichTestFunc func, const char * name, uint32_t runtime)
int cliTestMemorySpeed() int cliTestMemorySpeed()
{ {
serialPrint("Starting memory speed test..."); serialPrint("Starting memory speed test...");
CoTickDelay(100); RTOS_WAIT_MS(200);
watchdogSuspend(6000/*60s*/); watchdogSuspend(6000/*60s*/);
if (pulsesStarted()) { if (pulsesStarted()) {
@ -610,7 +610,7 @@ int cliTestMemorySpeed()
LTDC_Cmd(DISABLE); LTDC_Cmd(DISABLE);
serialPrint("Disabling LCD..."); serialPrint("Disabling LCD...");
CoTickDelay(100); RTOS_WAIT_MS(200);
result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_8bit, 200); result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_8bit, 200);
result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_32bit, 200); result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_32bit, 200);
@ -936,7 +936,7 @@ void printDebugTimers()
#endif #endif
#include "OsMutex.h" #include "OsMutex.h"
extern OS_MutexID audioMutex; extern RTOS_MUTEX_HANDLE audioMutex;
void printAudioVars() void printAudioVars()
{ {
@ -1124,7 +1124,7 @@ int cliRepeat(const char ** argv)
counter = interval; counter = interval;
uint8_t c; uint8_t c;
while (!cliRxFifo.pop(c) || !(c == '\r' || c == '\n' || c == ' ')) { while (!cliRxFifo.pop(c) || !(c == '\r' || c == '\n' || c == ' ')) {
CoTickDelay(10); // 20ms RTOS_WAIT_MS(20); // 20ms
if (++counter >= interval) { if (++counter >= interval) {
cliExecCommand(&argv[2]); cliExecCommand(&argv[2]);
counter = 0; counter = 0;
@ -1299,7 +1299,7 @@ void cliTask(void * pdata)
uint8_t c; uint8_t c;
while (!cliRxFifo.pop(c)) { while (!cliRxFifo.pop(c)) {
CoTickDelay(10); // 20ms RTOS_WAIT_MS(20); // 20ms
} }
if (c == 12) { if (c == 12) {

View file

@ -94,7 +94,7 @@ void dumpTraceBuffer()
#if !defined(SIMU) #if !defined(SIMU)
if ((n % 5) == 0) { if ((n % 5) == 0) {
while (!serial2TxFifo.isEmpty()) { while (!serial2TxFifo.isEmpty()) {
CoTickDelay(1); RTOS_WAIT_TICKS(1);
} }
} }
#endif #endif

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar font_5x7[] PROGMEM = { const pm_uchar font_5x7[] = {
#include "font_05x07.lbm" #include "font_05x07.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_05x07.lbm" #include "font_de_05x07.lbm"
@ -44,13 +44,13 @@ const pm_uchar font_5x7[] PROGMEM = {
}; };
#if defined(BOLD_SPECIFIC_FONT) #if defined(BOLD_SPECIFIC_FONT)
const pm_uchar font_5x7_B[] PROGMEM = { const pm_uchar font_5x7_B[] = {
#include "font_05x07_B_compressed.lbm" #include "font_05x07_B_compressed.lbm"
}; };
#endif #endif
#if !defined(BOOT) #if !defined(BOOT)
const pm_uchar font_10x14[] PROGMEM = { const pm_uchar font_10x14[] = {
#include "font_10x14_compressed.lbm" #include "font_10x14_compressed.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_10x14.lbm" #include "font_de_10x14.lbm"
@ -75,10 +75,10 @@ const pm_uchar font_10x14[] PROGMEM = {
#endif #endif
#if !defined(BOOT) #if !defined(BOOT)
const pm_uchar font_3x5[] PROGMEM = { const pm_uchar font_3x5[] = {
#include "font_03x05.lbm" #include "font_03x05.lbm"
}; };
const pm_uchar font_4x6[] PROGMEM = { const pm_uchar font_4x6[] = {
#include "font_04x06.lbm" #include "font_04x06.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_04x06.lbm" #include "font_de_04x06.lbm"
@ -101,7 +101,7 @@ const pm_uchar font_4x6[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_8x10[] PROGMEM = { const pm_uchar font_8x10[] = {
#include "font_08x10.lbm" #include "font_08x10.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_08x10.lbm" #include "font_de_08x10.lbm"
@ -124,19 +124,19 @@ const pm_uchar font_8x10[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_22x38_num[] PROGMEM = { const pm_uchar font_22x38_num[] = {
#include "font_22x38_num.lbm" #include "font_22x38_num.lbm"
}; };
const pm_uchar font_4x6_extra[] PROGMEM = { const pm_uchar font_4x6_extra[] = {
#include "font_04x06_extra.lbm" #include "font_04x06_extra.lbm"
}; };
const pm_uchar font_5x7_extra[] PROGMEM = { const pm_uchar font_5x7_extra[] = {
#include "font_05x07_extra.lbm" #include "font_05x07_extra.lbm"
}; };
const pm_uchar font_10x14_extra[] PROGMEM = { const pm_uchar font_10x14_extra[] = {
#include "font_10x14_extra.lbm" #include "font_10x14_extra.lbm"
}; };

View file

@ -361,7 +361,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx);
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr); void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
extern const pm_uchar sticks[] PROGMEM; extern const pm_uchar sticks[] ;
void drawSplash(); void drawSplash();
void drawSecondSplash(); void drawSecondSplash();

View file

@ -93,7 +93,7 @@ void menuRadioDiagAnalogs(event_t event);
void menuRadioHardware(event_t event); void menuRadioHardware(event_t event);
void menuRadioCalibration(event_t event); void menuRadioCalibration(event_t event);
static const MenuHandlerFunc menuTabGeneral[] PROGMEM = { static const MenuHandlerFunc menuTabGeneral[] = {
menuRadioSetup, menuRadioSetup,
CASE_SDCARD(menuRadioSdManager) CASE_SDCARD(menuRadioSdManager)
menuRadioSpecialFunctions, menuRadioSpecialFunctions,
@ -144,7 +144,7 @@ void menuModelDisplay(event_t event);
void menuModelTemplates(event_t event); void menuModelTemplates(event_t event);
void menuModelGVarOne(event_t event); void menuModelGVarOne(event_t event);
static const MenuHandlerFunc menuTabModel[] PROGMEM = { static const MenuHandlerFunc menuTabModel[] = {
menuModelSelect, menuModelSelect,
menuModelSetup, menuModelSetup,
CASE_HELI(menuModelHeli) CASE_HELI(menuModelHeli)

View file

@ -166,9 +166,9 @@ void menuModelCurveOne(event_t event)
lcdDrawFilledRect(3, 2*FH+4, 7*FW-2, 4*FH-2, SOLID, ERASE); lcdDrawFilledRect(3, 2*FH+4, 7*FW-2, 4*FH-2, SOLID, ERASE);
lcdDrawRect(3, 2*FH+4, 7*FW-2, 4*FH-2); lcdDrawRect(3, 2*FH+4, 7*FW-2, 4*FH-2);
drawStringWithIndex(7, 3*FH, STR_PT, i+1, LEFT); drawStringWithIndex(7, 3*FH, STR_PT, i+1, LEFT);
lcdDrawText(7, 4*FH, PSTR("x=")); lcdDrawText(7, 4*FH, "x=");
lcdDrawNumber(7+2*FW+1, 4*FH, x, LEFT|(selectionMode==1?attr:0)); lcdDrawNumber(7+2*FW+1, 4*FH, x, LEFT|(selectionMode==1?attr:0));
lcdDrawText(7, 5*FH, PSTR("y=")); lcdDrawText(7, 5*FH, "y=");
lcdDrawNumber(7+2*FW+1, 5*FH, points[i], LEFT|(selectionMode==2?attr:0)); lcdDrawNumber(7+2*FW+1, 5*FH, points[i], LEFT|(selectionMode==2?attr:0));
// Selection square // Selection square

View file

@ -123,7 +123,7 @@ void menuModelDisplay(event_t event)
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k); uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1); drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex); TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event); TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, "", STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
if (newScreenType != oldScreenType) { if (newScreenType != oldScreenType) {
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex)); g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex])); memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));

View file

@ -67,12 +67,12 @@ void menuModelFlightModeOne(event_t event)
#if defined(GVARS) && !defined(GVARS_IN_CURVES_SCREEN) #if defined(GVARS) && !defined(GVARS_IN_CURVES_SCREEN)
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define VERTICAL_SHIFT (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_TRIMS) #define VERTICAL_SHIFT (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_TRIMS)
static const pm_uint8_t mstate_tab_fm1[] PROGMEM = {0, 3, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1, 1}; static const pm_uint8_t mstate_tab_fm1[] = {0, 3, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1, 1};
#else #else
#define VERTICAL_SHIFT (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_SWITCH) #define VERTICAL_SHIFT (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_SWITCH)
static const pm_uint8_t mstate_tab_fm1[] PROGMEM = {0, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1}; static const pm_uint8_t mstate_tab_fm1[] = {0, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1};
#endif #endif
static const pm_uint8_t mstate_tab_others[] PROGMEM = {0, 0, 3, IF_ROTARY_ENCODERS(NUM_ROTARY_ENCODERS-1) 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2}; static const pm_uint8_t mstate_tab_others[] = {0, 0, 3, IF_ROTARY_ENCODERS(NUM_ROTARY_ENCODERS-1) 0, 0, (uint8_t)-1, 2, 2, 2, 2, 2};
check(event, 0, NULL, 0, (s_currIdx == 0) ? mstate_tab_fm1 : mstate_tab_others, DIM(mstate_tab_others)-1, ITEM_MODEL_FLIGHT_MODE_MAX - HEADER_LINE - (s_currIdx==0 ? (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_SWITCH-1) : 0)); check(event, 0, NULL, 0, (s_currIdx == 0) ? mstate_tab_fm1 : mstate_tab_others, DIM(mstate_tab_others)-1, ITEM_MODEL_FLIGHT_MODE_MAX - HEADER_LINE - (s_currIdx==0 ? (ITEM_MODEL_FLIGHT_MODE_FADE_IN-ITEM_MODEL_FLIGHT_MODE_SWITCH-1) : 0));

View file

@ -460,7 +460,7 @@ void menuModelMixOne(event_t event)
} }
} }
else { else {
lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, PSTR("Diff"), menuHorizontalPosition==0 ? attr : 0); lcdDrawText(COLUMN_X+MIXES_2ND_COLUMN, y, "Diff", menuHorizontalPosition==0 ? attr : 0);
md2->curveParam = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN+5*FW, y, curveParam, -100, 100, LEFT|(menuHorizontalPosition==1 ? attr : 0), 0, editMode>0 ? event : 0); md2->curveParam = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN+5*FW, y, curveParam, -100, 100, LEFT|(menuHorizontalPosition==1 ? attr : 0), 0, editMode>0 ? event : 0);
if (attr && editMode>0 && menuHorizontalPosition==0) { if (attr && editMode>0 && menuHorizontalPosition==0) {
int8_t tmp = 0; int8_t tmp = 0;
@ -508,7 +508,7 @@ void menuModelMixOne(event_t event)
} }
} }
#define _STR_MAX(x) PSTR("/" #x) #define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x) #define STR_MAX(x) _STR_MAX(x)
#define EXPO_LINE_WEIGHT_POS 7*FW+1 #define EXPO_LINE_WEIGHT_POS 7*FW+1

View file

@ -613,7 +613,7 @@ void menuModelSetup(event_t event)
attr = BLINK | INVERS; attr = BLINK | INVERS;
} }
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive) ? c : '-', attr); lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive) ? c : '-', attr);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? line : 0); lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, "<]", (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? line : 0);
} }
#endif #endif
break; break;
@ -621,7 +621,7 @@ void menuModelSetup(event_t event)
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
case ITEM_MODEL_POTS_WARNING: case ITEM_MODEL_POTS_WARNING:
lcdDrawTextAlignedLeft(y, STR_POTWARNING); lcdDrawTextAlignedLeft(y, STR_POTWARNING);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
if (attr && (menuHorizontalPosition == 0)) { if (attr && (menuHorizontalPosition == 0)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
storageDirty(EE_MODEL); storageDirty(EE_MODEL);
@ -1269,7 +1269,7 @@ void menuModelSetup(event_t event)
#if 0 #if 0
case ITEM_MODEL_PPM2_PROTOCOL: case ITEM_MODEL_PPM2_PROTOCOL:
lcdDrawTextAlignedLeft(y, PSTR("Port2")); lcdDrawTextAlignedLeft(y, "Port2");
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, menuHorizontalPosition<=0 ? attr : 0); lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, menuHorizontalPosition<=0 ? attr : 0);
lcdDrawNumber(lcdLastRightPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0)); lcdDrawNumber(lcdLastRightPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0));

View file

@ -545,10 +545,10 @@ void menuModelTelemetryFrsky(event_t event)
#if defined(MULTIMODULE) #if defined(MULTIMODULE)
if (telemetryProtocol == PROTOCOL_MULTIMODULE && if (telemetryProtocol == PROTOCOL_MULTIMODULE &&
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A) g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
lcdDrawTextAlignedLeft(y, PSTR("RSNR")); lcdDrawTextAlignedLeft(y, "RSNR");
else else
#endif #endif
lcdDrawTextAlignedLeft(y, PSTR("RSSI")); lcdDrawTextAlignedLeft(y, "RSSI");
break; break;
case ITEM_TELEMETRY_RSSI_ALARM1: case ITEM_TELEMETRY_RSSI_ALARM1:

View file

@ -47,7 +47,7 @@ void showMessageBox(const pm_char * str)
lcdRefresh(); lcdRefresh();
} }
const pm_uchar ASTERISK_BITMAP[] PROGMEM = { const pm_uchar ASTERISK_BITMAP[] = {
#include "asterisk.lbm" #include "asterisk.lbm"
}; };

View file

@ -45,7 +45,7 @@ void menuRadioDiagAnalogs(event_t event)
#else #else
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
uint8_t x = (i & 1) ? LCD_W/2+FW : 0; uint8_t x = (i & 1) ? LCD_W/2+FW : 0;
drawStringWithIndex(x, y, PSTR("A"), i+1); drawStringWithIndex(x, y, "A", i+1);
lcdDrawChar(lcdNextPos, y, ':'); lcdDrawChar(lcdNextPos, y, ':');
#endif #endif
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i)); lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));

View file

@ -52,7 +52,7 @@ void menuRadioHardware(event_t event)
break; break;
case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS: case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS:
lcdDrawTextAlignedLeft(y, PSTR("Sticks")); lcdDrawTextAlignedLeft(y, "Sticks");
break; break;
case ITEM_RADIO_HARDWARE_STICK_LV_GAIN: case ITEM_RADIO_HARDWARE_STICK_LV_GAIN:
@ -60,8 +60,8 @@ void menuRadioHardware(event_t event)
case ITEM_RADIO_HARDWARE_STICK_RV_GAIN: case ITEM_RADIO_HARDWARE_STICK_RV_GAIN:
case ITEM_RADIO_HARDWARE_STICK_RH_GAIN: case ITEM_RADIO_HARDWARE_STICK_RH_GAIN:
{ {
lcdDrawTextAtIndex(INDENT_WIDTH, y, PSTR("\002LVLHRVRH"), k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN, 0); lcdDrawTextAtIndex(INDENT_WIDTH, y, "\002LVLHRVRH", k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN, 0);
lcdDrawText(INDENT_WIDTH+3*FW, y, PSTR("Gain")); lcdDrawText(INDENT_WIDTH+3*FW, y, "Gain");
uint8_t mask = (1<<(k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN)); uint8_t mask = (1<<(k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN));
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0); uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
lcdDrawChar(HW_SETTINGS_COLUMN, y, val ? '2' : '1', attr); lcdDrawChar(HW_SETTINGS_COLUMN, y, val ? '2' : '1', attr);
@ -77,13 +77,13 @@ void menuRadioHardware(event_t event)
#if defined(ROTARY_ENCODERS) #if defined(ROTARY_ENCODERS)
case ITEM_RADIO_HARDWARE_ROTARY_ENCODER: case ITEM_RADIO_HARDWARE_ROTARY_ENCODER:
g_eeGeneral.rotarySteps = editChoice(HW_SETTINGS_COLUMN, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event); g_eeGeneral.rotarySteps = editChoice(HW_SETTINGS_COLUMN, y, "Rotary Encoder", "\0062steps4steps", g_eeGeneral.rotarySteps, 0, 1, attr, event);
break; break;
#endif #endif
#if defined(BLUETOOTH) #if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BT_BAUDRATE: case ITEM_RADIO_HARDWARE_BT_BAUDRATE:
g_eeGeneral.bluetoothBaudrate = editChoice(HW_SETTINGS_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.bluetoothBaudrate, 0, 2, attr, event); g_eeGeneral.bluetoothBaudrate = editChoice(HW_SETTINGS_COLUMN, y, STR_BAUDRATE, "\005115k 9600 19200", g_eeGeneral.bluetoothBaudrate, 0, 2, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
btInit(); btInit();
} }
@ -235,7 +235,7 @@ void menuRadioHardware(event_t event)
pauseMixerCalculations(); pauseMixerCalculations();
pausePulses(); pausePulses();
EXTERNAL_MODULE_OFF(); EXTERNAL_MODULE_OFF();
CoTickDelay(10); // 20ms so that the pulses interrupt will reinit the frame rate RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
telemetryProtocol = 255; // force telemetry port + module reinitialization telemetryProtocol = 255; // force telemetry port + module reinitialization
EXTERNAL_MODULE_ON(); EXTERNAL_MODULE_ON();
resumePulses(); resumePulses();

View file

@ -22,7 +22,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar sticks[] PROGMEM = { const pm_uchar sticks[] = {
#include "sticks.lbm" #include "sticks.lbm"
}; };
@ -166,7 +166,7 @@ void menuRadioSetup(event_t event)
{ {
int16_t year = TM_YEAR_BASE + t.tm_year; int16_t year = TM_YEAR_BASE + t.tm_year;
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0); int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const pm_uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
dlim += pgm_read_byte(&dmon[t.tm_mon]); dlim += pgm_read_byte(&dmon[t.tm_mon]);
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0|RIGHT, 2); lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0|RIGHT, 2);
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
@ -507,12 +507,12 @@ void menuRadioSetup(event_t event)
#if defined(FAI_CHOICE) #if defined(FAI_CHOICE)
case ITEM_SETUP_FAI: case ITEM_SETUP_FAI:
editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, PSTR("FAI Mode"), attr, event); editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, "FAI Mode", attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
if (g_eeGeneral.fai) if (g_eeGeneral.fai)
POPUP_WARNING(PSTR("FAI\001mode blocked!")); POPUP_WARNING("FAI\001mode blocked!");
else else
POPUP_CONFIRMATION(PSTR("FAI mode?")); POPUP_CONFIRMATION("FAI mode?");
} }
break; break;
#endif #endif

View file

@ -37,11 +37,11 @@ void menuRadioVersion(event_t event)
#if defined(COPROCESSOR) #if defined(COPROCESSOR)
if (Coproc_valid == 1) { if (Coproc_valid == 1) {
lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr:")); lcdDrawTextAlignedLeft(6*FH, "CoPr:");
lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read); lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read);
} }
else { else {
lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr: ---")); lcdDrawTextAlignedLeft(6*FH, "CoPr: ---");
} }
#elif defined(EEPROM_RLC) #elif defined(EEPROM_RLC)
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP); lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);

View file

@ -41,7 +41,7 @@
#endif #endif
#if defined(SPLASH) #if defined(SPLASH)
const pm_uchar splashdata[] PROGMEM = { const pm_uchar splashdata[] = {
'S','P','S',0, 'S','P','S',0,
#include "bitmaps/128x64/splash.lbm" #include "bitmaps/128x64/splash.lbm"
'S','P','E',0 }; 'S','P','E',0 };
@ -65,7 +65,7 @@ void drawSplash()
#endif #endif
#if defined(SPLASH_FRSKY) #if defined(SPLASH_FRSKY)
const pm_uchar splashdata2[] PROGMEM = { const pm_uchar splashdata2[] = {
'S','F','S',0, 'S','F','S',0,
#include "bitmaps/128x64/splash_frsky.lbm" #include "bitmaps/128x64/splash_frsky.lbm"
'S','F','E',0 }; 'S','F','E',0 };

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar about_bmp[] PROGMEM = { const pm_uchar about_bmp[] = {
#include "about.lbm" #include "about.lbm"
}; };

View file

@ -564,12 +564,12 @@ void menuMainView(event_t event)
warningText = STR_GLOBAL_VAR; warningText = STR_GLOBAL_VAR;
drawMessageBox(); drawMessageBox();
lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
lcdDrawText(16+6*FW, 5*FH, PSTR("["), BOLD); lcdDrawText(16+6*FW, 5*FH, "[", BOLD);
drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD);
if (g_model.gvars[gvarLastChanged].unit) { if (g_model.gvars[gvarLastChanged].unit) {
lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD); lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD);
} }
lcdDrawText(lcdLastRightPos, 5*FH, PSTR("]"), BOLD); lcdDrawText(lcdLastRightPos, 5*FH, "]", BOLD);
warningText = NULL; warningText = NULL;
} }
#endif #endif
@ -577,7 +577,7 @@ void menuMainView(event_t event)
#if defined(DSM2) #if defined(DSM2)
if (moduleFlag[0] == MODULE_BIND) { if (moduleFlag[0] == MODULE_BIND) {
// Issue 98 // Issue 98
lcdDrawText(15*FW, 0, PSTR("BIND"), 0); lcdDrawText(15*FW, 0, "BIND", 0);
} }
#endif #endif
} }

View file

@ -187,13 +187,13 @@ void menuStatisticsDebug(event_t event)
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP); lcdDrawTextAlignedLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP);
if (Coproc_read==0) { if (Coproc_read==0) {
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, "Co Proc NACK",INVERS);
} }
else if (Coproc_read==0x81) { else if (Coproc_read==0x81) {
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Inst.TinyApp"),INVERS); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, "Inst.TinyApp",INVERS);
} }
else if (Coproc_read<3) { else if (Coproc_read<3) {
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Upgr.TinyApp"),INVERS); lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, "Upgr.TinyApp",INVERS);
} }
else { else {
drawValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT); drawValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT);

View file

@ -246,7 +246,7 @@ void drawProgressBar(const char * label, int num, int den)
lcdRefresh(); lcdRefresh();
} }
const pm_uchar SLEEP_BITMAP[] PROGMEM = { const pm_uchar SLEEP_BITMAP[] = {
#include "sleep.lbm" #include "sleep.lbm"
}; };

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar font_5x7[] PROGMEM = { const pm_uchar font_5x7[] = {
#include "font_05x07.lbm" #include "font_05x07.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_05x07.lbm" #include "font_de_05x07.lbm"
@ -43,12 +43,12 @@ const pm_uchar font_5x7[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_5x7_B[] PROGMEM = { const pm_uchar font_5x7_B[] = {
#include "font_05x07_B_compressed.lbm" #include "font_05x07_B_compressed.lbm"
}; };
#if !defined(BOOT) #if !defined(BOOT)
const pm_uchar font_10x14[] PROGMEM = { const pm_uchar font_10x14[] = {
#include "font_10x14_compressed.lbm" #include "font_10x14_compressed.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_10x14.lbm" #include "font_de_10x14.lbm"
@ -71,11 +71,11 @@ const pm_uchar font_10x14[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_3x5[] PROGMEM = { const pm_uchar font_3x5[] = {
#include "font_03x05.lbm" #include "font_03x05.lbm"
}; };
const pm_uchar font_4x6[] PROGMEM = { const pm_uchar font_4x6[] = {
#include "font_04x06.lbm" #include "font_04x06.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_04x06.lbm" #include "font_de_04x06.lbm"
@ -98,7 +98,7 @@ const pm_uchar font_4x6[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_8x10[] PROGMEM = { const pm_uchar font_8x10[] = {
#include "font_08x10.lbm" #include "font_08x10.lbm"
#if defined(TRANSLATIONS_DE) #if defined(TRANSLATIONS_DE)
#include "font_de_08x10.lbm" #include "font_de_08x10.lbm"
@ -121,19 +121,19 @@ const pm_uchar font_8x10[] PROGMEM = {
#endif #endif
}; };
const pm_uchar font_22x38_num[] PROGMEM = { const pm_uchar font_22x38_num[] = {
#include "font_22x38_num.lbm" #include "font_22x38_num.lbm"
}; };
const pm_uchar font_4x6_extra[] PROGMEM = { const pm_uchar font_4x6_extra[] = {
#include "font_04x06_extra.lbm" #include "font_04x06_extra.lbm"
}; };
const pm_uchar font_5x7_extra[] PROGMEM = { const pm_uchar font_5x7_extra[] = {
#include "font_05x07_extra.lbm" #include "font_05x07_extra.lbm"
}; };
const pm_uchar font_10x14_extra[] PROGMEM = { const pm_uchar font_10x14_extra[] = {
#include "font_10x14_extra.lbm" #include "font_10x14_extra.lbm"
}; };

View file

@ -326,7 +326,7 @@ uint8_t switchToMix(uint8_t source);
extern coord_t scrollbar_X; extern coord_t scrollbar_X;
#define SET_SCROLLBAR_X(x) scrollbar_X = (x); #define SET_SCROLLBAR_X(x) scrollbar_X = (x);
extern const pm_uchar sticks[] PROGMEM; extern const pm_uchar sticks[] ;
#if defined(FLIGHT_MODES) #if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value); void displayFlightModes(coord_t x, coord_t y, FlightModesType value);

View file

@ -125,7 +125,7 @@ void menuModelDisplay(event_t event)
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k); uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1); drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex); TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event); TelemetryScreenType newScreenType = (TelemetryScreenType)editChoice(DISPLAY_COL2, y, "", STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
if (newScreenType != oldScreenType) { if (newScreenType != oldScreenType) {
g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex)); g_model.frsky.screensType = (g_model.frsky.screensType & (~(0x03 << (2*screenIndex)))) | (newScreenType << (2*screenIndex));
memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex])); memset(&g_model.frsky.screens[screenIndex], 0, sizeof(g_model.frsky.screens[screenIndex]));

View file

@ -574,7 +574,7 @@ void menuModelSetup(event_t event)
#endif #endif
lcdDrawTextAlignedLeft(y, STR_POTWARNING); lcdDrawTextAlignedLeft(y, STR_POTWARNING);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
if (attr && (menuHorizontalPosition == 0)) { if (attr && (menuHorizontalPosition == 0)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
storageDirty(EE_MODEL); storageDirty(EE_MODEL);

View file

@ -519,10 +519,10 @@ void menuModelTelemetryFrsky(event_t event)
if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT && if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT &&
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A) g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
lcdDrawTextAlignedLeft(y, PSTR("RSNR")); lcdDrawTextAlignedLeft(y, "RSNR");
else else
#endif #endif
lcdDrawTextAlignedLeft(y, PSTR("RSSI")); lcdDrawTextAlignedLeft(y, "RSSI");
break; break;
case ITEM_TELEMETRY_RSSI_ALARM1: case ITEM_TELEMETRY_RSSI_ALARM1:

View file

@ -44,7 +44,7 @@ void showMessageBox(const char * title)
lcdRefresh(); lcdRefresh();
} }
const pm_uchar ASTERISK_BITMAP[] PROGMEM = { const pm_uchar ASTERISK_BITMAP[] = {
#include "asterisk.lbm" #include "asterisk.lbm"
}; };

View file

@ -22,7 +22,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar sticks[] PROGMEM = { const pm_uchar sticks[] = {
#include "sticks.lbm" #include "sticks.lbm"
}; };
@ -149,7 +149,7 @@ void menuRadioSetup(event_t event)
{ {
int16_t year = TM_YEAR_BASE + t.tm_year; int16_t year = TM_YEAR_BASE + t.tm_year;
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0); int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const pm_uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
dlim += pgm_read_byte(&dmon[t.tm_mon]); dlim += pgm_read_byte(&dmon[t.tm_mon]);
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0|RIGHT, 2); lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0|RIGHT, 2);
if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
@ -455,12 +455,12 @@ void menuRadioSetup(event_t event)
#if defined(FAI_CHOICE) #if defined(FAI_CHOICE)
case ITEM_SETUP_FAI: case ITEM_SETUP_FAI:
editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, PSTR("FAI Mode"), attr, event); editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, "FAI Mode"), attr, event;
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
if (g_eeGeneral.fai) if (g_eeGeneral.fai)
POPUP_WARNING(PSTR("FAI\001mode blocked!")); POPUP_WARNING("FAI\001mode blocked!");
else else
POPUP_CONFIRMATION(PSTR("FAI mode?")); POPUP_CONFIRMATION("FAI mode?");
} }
break; break;
#endif #endif

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
#if defined(SPLASH) #if defined(SPLASH)
const pm_uchar splashdata[] PROGMEM = { const pm_uchar splashdata[] = {
'S','P','S',0, 'S','P','S',0,
#include "bitmaps/212x64/splash.lbm" #include "bitmaps/212x64/splash.lbm"
'S','P','E',0 }; 'S','P','E',0 };
@ -44,7 +44,7 @@ void drawSplash()
#endif #endif
#if defined(SPLASH_FRSKY) #if defined(SPLASH_FRSKY)
const pm_uchar splashdata2[] PROGMEM = { const pm_uchar splashdata2[] = {
'S','F','S',0, 'S','F','S',0,
#include "bitmaps/212x64/splash_frsky.lbm" #include "bitmaps/212x64/splash_frsky.lbm"
'S','F','E',0 }; 'S','F','E',0 };

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar about_bmp[] PROGMEM = { const pm_uchar about_bmp[] = {
#include "about.lbm" #include "about.lbm"
}; };

View file

@ -49,11 +49,11 @@
#define TRIM_LEN 27 #define TRIM_LEN 27
#define MARKER_WIDTH 5 #define MARKER_WIDTH 5
const pm_uchar logo_taranis[] PROGMEM = { const pm_uchar logo_taranis[] = {
#include "logo.lbm" #include "logo.lbm"
}; };
const pm_uchar icons[] PROGMEM = { const pm_uchar icons[] = {
#include "icons.lbm" #include "icons.lbm"
}; };
@ -594,9 +594,9 @@ void menuMainView(event_t event)
lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32); lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32);
drawStringWithIndex(BITMAP_X+FW, BITMAP_Y+FH-1, STR_GV, gvarLastChanged+1); drawStringWithIndex(BITMAP_X+FW, BITMAP_Y+FH-1, STR_GV, gvarLastChanged+1);
lcdDrawSizedText(BITMAP_X+4*FW+FW/2, BITMAP_Y+FH-1, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); lcdDrawSizedText(BITMAP_X+4*FW+FW/2, BITMAP_Y+FH-1, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
lcdDrawText(BITMAP_X+FW, BITMAP_Y+2*FH+3, PSTR("["), BOLD); lcdDrawText(BITMAP_X+FW, BITMAP_Y+2*FH+3, "[", BOLD;
drawGVarValue(BITMAP_X+2*FW, BITMAP_Y+2*FH+3, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); drawGVarValue(BITMAP_X+2*FW, BITMAP_Y+2*FH+3, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD);
lcdDrawText(lcdLastRightPos, BITMAP_Y+2*FH+3, PSTR("]"), BOLD); lcdDrawText(lcdLastRightPos, BITMAP_Y+2*FH+3, "]", BOLD;
} }
#endif #endif
} }

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
const pm_uchar SLEEP_BITMAP[] PROGMEM = { const pm_uchar SLEEP_BITMAP[] = {
#include "../../bitmaps/212x64/sleep.lbm" #include "../../bitmaps/212x64/sleep.lbm"
}; };
@ -34,7 +34,7 @@ void drawSleepBitmap()
} }
#if defined(PWR_BUTTON_PRESS) #if defined(PWR_BUTTON_PRESS)
const pm_uchar SHUTDOWN_BITMAP[] PROGMEM = { const pm_uchar SHUTDOWN_BITMAP[] = {
#include "../../bitmaps/212x64/shutdown.lbm" #include "../../bitmaps/212x64/shutdown.lbm"
}; };

View file

@ -218,7 +218,7 @@ bool menuStatsDebug(event_t event);
bool menuStatsAnalogs(event_t event); bool menuStatsAnalogs(event_t event);
bool menuStatsTraces(event_t event); bool menuStatsTraces(event_t event);
static const MenuHandlerFunc menuTabStats[] PROGMEM = { static const MenuHandlerFunc menuTabStats[] = {
menuStatsGraph, menuStatsGraph,
menuStatsDebug, menuStatsDebug,
menuStatsAnalogs, menuStatsAnalogs,
@ -243,7 +243,7 @@ extern uint8_t lastMonitorPage;
extern void drawSingleMixerBar(coord_t, coord_t, coord_t, coord_t, uint8_t); extern void drawSingleMixerBar(coord_t, coord_t, coord_t, coord_t, uint8_t);
extern void drawSingleOutputBar(coord_t, coord_t, coord_t, coord_t, uint8_t); extern void drawSingleOutputBar(coord_t, coord_t, coord_t, coord_t, uint8_t);
extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM; extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] ;
bool menuFirstCalib(event_t event); bool menuFirstCalib(event_t event);
bool menuMainView(event_t event); bool menuMainView(event_t event);

View file

@ -303,7 +303,7 @@ bool menuModelExpoOne(event_t event)
return true; return true;
} }
#define _STR_MAX(x) PSTR("/" #x) #define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x) #define STR_MAX(x) _STR_MAX(x)
#define EXPO_LINE_WEIGHT_POS 125 #define EXPO_LINE_WEIGHT_POS 125

View file

@ -280,7 +280,7 @@ bool menuModelMixOne(event_t event)
return true; return true;
} }
#define _STR_MAX(x) PSTR("/" #x) #define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x) #define STR_MAX(x) _STR_MAX(x)
#define MIX_LINE_WEIGHT_POS 105 #define MIX_LINE_WEIGHT_POS 105

View file

@ -530,7 +530,7 @@ bool menuModelSetup(event_t event)
case ITEM_MODEL_SLIDPOT_WARNING_STATE: case ITEM_MODEL_SLIDPOT_WARNING_STATE:
lcdDrawText(MENUS_MARGIN_LEFT, y,STR_POTWARNINGSTATE); lcdDrawText(MENUS_MARGIN_LEFT, y,STR_POTWARNINGSTATE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, attr); lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, attr);
if (attr) { if (attr) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
storageDirty(EE_MODEL); storageDirty(EE_MODEL);

View file

@ -526,10 +526,10 @@ bool menuModelTelemetryFrsky(event_t event)
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF &&
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A) g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
lcdDrawText(MENUS_MARGIN_LEFT, y, PSTR("RSNR")); lcdDrawText(MENUS_MARGIN_LEFT, y, "RSNR");
else else
#endif #endif
lcdDrawText(MENUS_MARGIN_LEFT, y, PSTR("RSSI")); lcdDrawText(MENUS_MARGIN_LEFT, y, "RSSI");
break; break;
case ITEM_TELEMETRY_RSSI_ALARM1: case ITEM_TELEMETRY_RSSI_ALARM1:

View file

@ -179,7 +179,7 @@ bool menuRadioHardware(event_t event)
pauseMixerCalculations(); pauseMixerCalculations();
pausePulses(); pausePulses();
EXTERNAL_MODULE_OFF(); EXTERNAL_MODULE_OFF();
CoTickDelay(10); // 20ms so that the pulses interrupt will reinit the frame rate RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
telemetryProtocol = 255; // force telemetry port + module reinitialization telemetryProtocol = 255; // force telemetry port + module reinitialization
EXTERNAL_MODULE_ON(); EXTERNAL_MODULE_ON();
resumePulses(); resumePulses();

View file

@ -67,7 +67,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
void getSelectionFullPath(char * lfn) void getSelectionFullPath(char * lfn)
{ {
f_getcwd(lfn, _MAX_LFN); f_getcwd(lfn, _MAX_LFN);
strcat(lfn, PSTR("/")); strcat(lfn, "/");
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - menuVerticalOffset]); strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - menuVerticalOffset]);
} }
@ -95,7 +95,7 @@ void onSdManagerMenu(const char * result)
f_getcwd(lfn, _MAX_LFN); f_getcwd(lfn, _MAX_LFN);
// if destination is dir, copy into that dir // if destination is dir, copy into that dir
if (IS_DIRECTORY(line)) { if (IS_DIRECTORY(line)) {
strcat(lfn, PSTR("/")); strcat(lfn, "/");
strcat(lfn, line); strcat(lfn, line);
} }
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory

View file

@ -154,7 +154,7 @@ bool menuRadioSetup(event_t event)
{ {
int16_t year = TM_YEAR_BASE + t.tm_year; int16_t year = TM_YEAR_BASE + t.tm_year;
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0); int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const pm_uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
dlim += pgm_read_byte(&dmon[t.tm_mon]); dlim += pgm_read_byte(&dmon[t.tm_mon]);
lcdDrawNumber(lcdNextPos+3, y, t.tm_mday, flags|rowattr|LEADING0, 2); lcdDrawNumber(lcdNextPos+3, y, t.tm_mday, flags|rowattr|LEADING0, 2);
if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
@ -427,15 +427,15 @@ bool menuRadioSetup(event_t event)
#if defined(FAI_CHOICE) #if defined(FAI_CHOICE)
case ITEM_SETUP_FAI: case ITEM_SETUP_FAI:
lcdDrawText(MENUS_MARGIN_LEFT, y, PSTR("FAI Mode")); lcdDrawText(MENUS_MARGIN_LEFT, y, "FAI Mode");
if (g_eeGeneral.fai) { if (g_eeGeneral.fai) {
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, PSTR("Locked in FAI Mode")); lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, "Locked in FAI Mode");
} }
else { else {
g_eeGeneral.fai = editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, attr, event); g_eeGeneral.fai = editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, attr, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
g_eeGeneral.fai = false; g_eeGeneral.fai = false;
POPUP_CONFIRMATION(PSTR("FAI mode?")); POPUP_CONFIRMATION("FAI mode?");
} }
} }
break; break;

View file

@ -43,7 +43,7 @@ bool menuChannelsMonitor(event_t event)
return menuChannelsMonitor(event, index); return menuChannelsMonitor(event, index);
} }
const MenuHandlerFunc menuTabMonitors[] PROGMEM = { const MenuHandlerFunc menuTabMonitors[] = {
menuChannelsMonitor<0>, menuChannelsMonitor<0>,
menuChannelsMonitor<1>, menuChannelsMonitor<1>,
menuChannelsMonitor<2>, menuChannelsMonitor<2>,

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
#define _STR_MAX(x) PSTR("/" #x) #define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x) #define STR_MAX(x) _STR_MAX(x)
uint8_t getExposCount() uint8_t getExposCount()

View file

@ -20,7 +20,7 @@
#include "opentx.h" #include "opentx.h"
#define _STR_MAX(x) PSTR("/" #x) #define _STR_MAX(x) "/" #x
#define STR_MAX(x) _STR_MAX(x) #define STR_MAX(x) _STR_MAX(x)
uint8_t getMixesCount() uint8_t getMixesCount()

View file

@ -64,7 +64,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
void getSelectionFullPath(char * lfn) void getSelectionFullPath(char * lfn)
{ {
f_getcwd(lfn, _MAX_LFN); f_getcwd(lfn, _MAX_LFN);
strcat(lfn, PSTR("/")); strcat(lfn, "/");
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - HEADER_LINE - menuVerticalOffset]); strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - HEADER_LINE - menuVerticalOffset]);
} }
@ -92,7 +92,7 @@ void onSdManagerMenu(const char * result)
f_getcwd(lfn, _MAX_LFN); f_getcwd(lfn, _MAX_LFN);
// if destination is dir, copy into that dir // if destination is dir, copy into that dir
if (IS_DIRECTORY(line)) { if (IS_DIRECTORY(line)) {
strcat(lfn, PSTR("/")); strcat(lfn, "/");
strcat(lfn, line); strcat(lfn, line);
} }
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
@ -114,7 +114,7 @@ void onSdManagerMenu(const char * result)
getSelectionFullPath(lfn); getSelectionFullPath(lfn);
f_unlink(lfn); f_unlink(lfn);
strncpy(statusLineMsg, line, 13); strncpy(statusLineMsg, line, 13);
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED); strcpy(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
showStatusLine(); showStatusLine();
REFRESH_FILES(); REFRESH_FILES();
} }

View file

@ -647,53 +647,53 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable)
// we don't need the special eeprom/flash string handling, just define them as // we don't need the special eeprom/flash string handling, just define them as
// local strings // local strings
const pm_char STR_SUBTYPE_FLYSKY[] PROGMEM = "\004""Std\0""V9x9""V6x6""V912""CX20"; const pm_char STR_SUBTYPE_FLYSKY[] = "\004""Std\0""V9x9""V6x6""V912""CX20";
const pm_char STR_SUBTYPE_AFHDS2A[] PROGMEM = "\010""PWM,IBUS""PPM,IBUS""PWM,SBUS""PPM,SBUS"; const pm_char STR_SUBTYPE_AFHDS2A[] = "\010""PWM,IBUS""PPM,IBUS""PWM,SBUS""PPM,SBUS";
const pm_char STR_SUBTYPE_FRSKY[] PROGMEM = "\007""D16\0 ""D8\0 ""D16 8ch""V8\0 ""LBT(EU)""LBT 8ch"; const pm_char STR_SUBTYPE_FRSKY[] = "\007""D16\0 ""D8\0 ""D16 8ch""V8\0 ""LBT(EU)""LBT 8ch";
const pm_char STR_SUBTYPE_HISKY[] PROGMEM = "\005""HiSky""HK310"; const pm_char STR_SUBTYPE_HISKY[] = "\005""HiSky""HK310";
const pm_char STR_SUBTYPE_DSM[] PROGMEM = "\006""2 22ms""2 11ms""X 22ms""X 11ms"; const pm_char STR_SUBTYPE_DSM[] = "\006""2 22ms""2 11ms""X 22ms""X 11ms";
const pm_char STR_SUBTYPE_YD717[] PROGMEM = "\007""YD717\0 ""SKYWLKR""Syma X2""XINXUN\0""NIHUI\0 "; const pm_char STR_SUBTYPE_YD717[] = "\007""YD717\0 ""SKYWLKR""Syma X2""XINXUN\0""NIHUI\0 ";
const pm_char STR_SUBTYPE_SYMAX[] PROGMEM = "\003""Std""5c\0"; const pm_char STR_SUBTYPE_SYMAX[] = "\003""Std""5c\0";
const pm_char STR_SUBTYPE_SLT[] PROGMEM = "\005""SLT\0 ""Vista"; const pm_char STR_SUBTYPE_SLT[] = "\005""SLT\0 ""Vista";
const pm_char STR_SUBTYPE_CX10[] PROGMEM = "\007""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041""Q242\0 "; const pm_char STR_SUBTYPE_CX10[] = "\007""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041""Q242\0 ";
const pm_char STR_SUBTYPE_CG023[] PROGMEM = "\005""CG023""YD829"; const pm_char STR_SUBTYPE_CG023[] = "\005""CG023""YD829";
const pm_char STR_SUBTYPE_KN[] PROGMEM = "\006""WLtoys""FeiLun"; const pm_char STR_SUBTYPE_KN[] = "\006""WLtoys""FeiLun";
const pm_char STR_SUBTYPE_MT99[] PROGMEM = "\005""MT99\0""H7\0 ""YZ\0 ""LS\0 ""FY805"; const pm_char STR_SUBTYPE_MT99[] = "\005""MT99\0""H7\0 ""YZ\0 ""LS\0 ""FY805";
const pm_char STR_SUBTYPE_MJXQ[] PROGMEM = "\005""WLH08""X600\0""X800\0""H26D\0""E010\0""H26WH"; const pm_char STR_SUBTYPE_MJXQ[] = "\005""WLH08""X600\0""X800\0""H26D\0""E010\0""H26WH";
const pm_char STR_SUBTYPE_HONTAI[] PROGMEM = "\007""Std\0 ""JJRC X1""X5C1cln"; const pm_char STR_SUBTYPE_HONTAI[] = "\007""Std\0 ""JJRC X1""X5C1cln";
const pm_char STR_SUBTYPE_Q2X2[] PROGMEM = "\004""Q222""Q242""Q282"; const pm_char STR_SUBTYPE_Q2X2[] = "\004""Q222""Q242""Q282";
const pm_char STR_SUBTYPE_Q303[] PROGMEM = "\006""Q303\0 ""CX35\0 ""CX10D\0""CX10WD"; const pm_char STR_SUBTYPE_Q303[] = "\006""Q303\0 ""CX35\0 ""CX10D\0""CX10WD";
const pm_char STR_SUBTYPE_WK2x01[] PROGMEM = "\006""WK2801""WK2401""W6_5_1""W6_6_1""W6_Hel""W6_HeI"; const pm_char STR_SUBTYPE_WK2x01[] = "\006""WK2801""WK2401""W6_5_1""W6_6_1""W6_Hel""W6_HeI";
const pm_char STR_SUBTYPE_V2X2[] PROGMEM = "\006""V2x2\0 ""JXD506"; const pm_char STR_SUBTYPE_V2X2[] = "\006""V2x2\0 ""JXD506";
const pm_char STR_SUBTYPE_BAYANG[] PROGMEM = "\007""Bayang\0""H8S3D\0 ""X16 AH\0 ""irdrone"; const pm_char STR_SUBTYPE_BAYANG[] = "\007""Bayang\0""H8S3D\0 ""X16 AH\0 ""irdrone";
const pm_char STR_SUBTYPE_FY326[] PROGMEM = "\005""FY326""FY319"; const pm_char STR_SUBTYPE_FY326[] = "\005""FY326""FY319";
const pm_char STR_SUBTYPE_CABELL[] PROGMEM = "\006""CAB_V3""C_TELM""-\0 ""-\0 ""-\0 ""-\0 ""F_SAFE""UNBIND"; const pm_char STR_SUBTYPE_CABELL[] = "\006""CAB_V3""C_TELM""-\0 ""-\0 ""-\0 ""-\0 ""F_SAFE""UNBIND";
const pm_char STR_SUBTYPE_H83D[] PROGMEM = "\006""H8_3D\0""H20H\0 ""H20Mini""H30Mini"; const pm_char STR_SUBTYPE_H83D[] = "\006""H8_3D\0""H20H\0 ""H20Mini""H30Mini";
const pm_char STR_SUBTYPE_CORONA[] PROGMEM = "\005""V1\0 ""V2\0 ""FD V3"; const pm_char STR_SUBTYPE_CORONA[] = "\005""V1\0 ""V2\0 ""FD V3";
const pm_char STR_SUBTYPE_HITEC[] PROGMEM = "\006""Optima\0""Minima"; const pm_char STR_SUBTYPE_HITEC[] = "\006""Optima\0""Minima";
const mm_protocol_definition multi_protocols[] = { const mm_protocol_definition multi_protocols[] = {

View file

@ -38,7 +38,7 @@ const char * writeScreenshot()
char filename[42]; // /SCREENSHOTS/screen-2013-01-01-123540.bmp char filename[42]; // /SCREENSHOTS/screen-2013-01-01-123540.bmp
// check and create folder here // check and create folder here
strcpy_P(filename, SCREENSHOTS_PATH); strcpy(filename, SCREENSHOTS_PATH);
const char * error = sdCheckAndCreateDirectory(filename); const char * error = sdCheckAndCreateDirectory(filename);
if (error) { if (error) {
return error; return error;

View file

@ -138,7 +138,7 @@ bool sportWaitState(SportUpdateState state, int timeout)
else if (sportUpdateState == SPORT_FAIL) { else if (sportUpdateState == SPORT_FAIL) {
return false; return false;
} }
CoTickDelay(1); RTOS_WAIT_TICKS(1);
} }
return false; return false;
#endif #endif
@ -313,7 +313,7 @@ void sportFlashDevice(ModuleIndex module, const char * filename)
/* wait 2s off */ /* wait 2s off */
watchdogSuspend(2000); watchdogSuspend(2000);
CoTickDelay(1000); RTOS_WAIT_MS(2000);
#endif #endif
const char * result = sportUpdatePowerOn(module); const char * result = sportUpdatePowerOn(module);

View file

@ -179,7 +179,7 @@ void killEvents(event_t event)
bool clearKeyEvents() bool clearKeyEvents()
{ {
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
CoTickDelay(100); // 200ms RTOS_WAIT_MS(200); // 200ms
#endif #endif
// loop until all keys are up // loop until all keys are up

View file

@ -54,7 +54,7 @@ const pm_char * logsOpen()
return STR_SDCARD_FULL; return STR_SDCARD_FULL;
// check and create folder here // check and create folder here
strcpy_P(filename, STR_LOGS_PATH); strcpy(filename, STR_LOGS_PATH);
const char * error = sdCheckAndCreateDirectory(filename); const char * error = sdCheckAndCreateDirectory(filename);
if (error) { if (error) {
return error; return error;
@ -85,7 +85,7 @@ const pm_char * logsOpen()
// TODO // TODO
uint8_t num = 1; uint8_t num = 1;
#endif #endif
strcpy_P(&filename[sizeof(LOGS_PATH)], STR_MODEL); strcpy(&filename[sizeof(LOGS_PATH)], STR_MODEL);
filename[sizeof(LOGS_PATH) + PSIZE(TR_MODEL)] = (char)((num / 10) + '0'); filename[sizeof(LOGS_PATH) + PSIZE(TR_MODEL)] = (char)((num / 10) + '0');
filename[sizeof(LOGS_PATH) + PSIZE(TR_MODEL) + 1] = (char)((num % 10) + '0'); filename[sizeof(LOGS_PATH) + PSIZE(TR_MODEL) + 1] = (char)((num % 10) + '0');
len = sizeof(LOGS_PATH) + PSIZE(TR_MODEL) + 2; len = sizeof(LOGS_PATH) + PSIZE(TR_MODEL) + 2;
@ -97,7 +97,7 @@ const pm_char * logsOpen()
tmp = strAppendDate(&filename[len]); tmp = strAppendDate(&filename[len]);
#endif #endif
strcpy_P(tmp, STR_LOGS_EXT); strcpy(tmp, STR_LOGS_EXT);
result = f_open(&g_oLogFile, filename, FA_OPEN_ALWAYS | FA_WRITE | FA_OPEN_APPEND); result = f_open(&g_oLogFile, filename, FA_OPEN_ALWAYS | FA_WRITE | FA_OPEN_APPEND);
if (result != FR_OK) { if (result != FR_OK) {

View file

@ -48,7 +48,7 @@ union ReusableBuffer reusableBuffer __DMA;
uint8_t* MSC_BOT_Data = reusableBuffer.MSC_BOT_Data; uint8_t* MSC_BOT_Data = reusableBuffer.MSC_BOT_Data;
#endif #endif
const pm_uint8_t bchout_ar[] PROGMEM = { const pm_uint8_t bchout_ar[] = {
0x1B, 0x1E, 0x27, 0x2D, 0x36, 0x39, 0x1B, 0x1E, 0x27, 0x2D, 0x36, 0x39,
0x4B, 0x4E, 0x63, 0x6C, 0x72, 0x78, 0x4B, 0x4E, 0x63, 0x6C, 0x72, 0x78,
0x87, 0x8D, 0x93, 0x9C, 0xB1, 0xB4, 0x87, 0x8D, 0x93, 0x9C, 0xB1, 0xB4,
@ -65,7 +65,7 @@ mode2 rud thr ele ail
mode3 ail ele thr rud mode3 ail ele thr rud
mode4 ail thr ele rud mode4 ail thr ele rud
*/ */
const pm_uint8_t modn12x3[] PROGMEM = { const pm_uint8_t modn12x3[] = {
0, 1, 2, 3, 0, 1, 2, 3,
0, 2, 1, 3, 0, 2, 1, 3,
3, 1, 2, 0, 3, 1, 2, 0,
@ -784,11 +784,7 @@ void doSplash()
tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT; tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT;
while (tgtime > get_tmr10ms()) { while (tgtime > get_tmr10ms()) {
#if defined(SIMU) RTOS_WAIT_TICKS(1);
SIMU_SLEEP(1);
#else
CoTickDelay(1);
#endif
getADC(); getADC();
@ -924,11 +920,7 @@ void checkAll()
showMessageBox(STR_KEYSTUCK); showMessageBox(STR_KEYSTUCK);
tmr10ms_t tgtime = get_tmr10ms() + 500; tmr10ms_t tgtime = get_tmr10ms() + 500;
while (tgtime != get_tmr10ms()) { while (tgtime != get_tmr10ms()) {
#if defined(SIMU) RTOS_WAIT_MS(1);
SIMU_SLEEP(1);
#else
CoTickDelay(1);
#endif
wdt_reset(); wdt_reset();
} }
} }
@ -1017,9 +1009,7 @@ void checkTHR()
wdt_reset(); wdt_reset();
SIMU_SLEEP(1); RTOS_WAIT_MS(10);
CoTickDelay(10);
} }
LED_ERROR_END(); LED_ERROR_END();
@ -1049,8 +1039,7 @@ void alert(const pm_char * title, const pm_char * msg , uint8_t sound)
#endif #endif
while (1) { while (1) {
SIMU_SLEEP(1); RTOS_WAIT_MS(10);
CoTickDelay(10);
if (keyDown()) break; // wait for key release if (keyDown()) break; // wait for key release
@ -1576,7 +1565,7 @@ void doMixerCalculations()
#if defined(NAVIGATION_STICKS) #if defined(NAVIGATION_STICKS)
uint8_t StickScrollAllowed; uint8_t StickScrollAllowed;
uint8_t StickScrollTimer; uint8_t StickScrollTimer;
static const pm_uint8_t rate[] PROGMEM = { 0, 0, 100, 40, 16, 7, 3, 1 } ; static const pm_uint8_t rate[] = { 0, 0, 100, 40, 16, 7, 3, 1 } ;
uint8_t calcStickScroll( uint8_t index ) uint8_t calcStickScroll( uint8_t index )
{ {
@ -1626,7 +1615,7 @@ void opentxStart(OPENTX_START_ARGS)
#if defined(PCBSKY9X) && defined(SDCARD) && !defined(SIMU) #if defined(PCBSKY9X) && defined(SDCARD) && !defined(SIMU)
for (int i=0; i<500 && !Card_initialized; i++) { for (int i=0; i<500 && !Card_initialized; i++) {
CoTickDelay(1); // 2ms RTOS_WAIT_MS(2); // 2ms
} }
#endif #endif
@ -1693,9 +1682,10 @@ void opentxClose(uint8_t shutdown)
storageCheck(true); storageCheck(true);
while (IS_PLAYING(ID_PLAY_PROMPT_BASE + AU_BYE)) { while (IS_PLAYING(ID_PLAY_PROMPT_BASE + AU_BYE)) {
CoTickDelay(10); RTOS_WAIT_MS(10);
} }
CoTickDelay(50);
RTOS_WAIT_MS(100);
#if defined(SDCARD) #if defined(SDCARD)
sdDone(); sdDone();
@ -2265,7 +2255,7 @@ uint32_t pwrCheck()
RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED); RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED);
while (TELEMETRY_STREAMING()) { while (TELEMETRY_STREAMING()) {
resetForcePowerOffRequest(); resetForcePowerOffRequest();
CoTickDelay(10); RTOS_WAIT_MS(20);
if (pwrPressed()) { if (pwrPressed()) {
return e_power_on; return e_power_on;
} }

View file

@ -236,8 +236,6 @@
typedef const int16_t pm_int16_t; typedef const int16_t pm_int16_t;
typedef const int8_t pm_int8_t; typedef const int8_t pm_int8_t;
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short)) #define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
#define PSTR(adr) adr
#define PROGMEM
#define pgm_read_adr(x) *(x) #define pgm_read_adr(x) *(x)
#define cli() #define cli()
#define sei() #define sei()
@ -518,8 +516,6 @@ extern uint8_t flightModeTransitionLast;
#elif !defined(SIMU) #elif !defined(SIMU)
extern unsigned char *heap; extern unsigned char *heap;
extern int _end; extern int _end;
extern int _estack;
extern int _main_stack_start;
extern int _heap_end; extern int _heap_end;
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap)) #define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
#endif #endif
@ -666,7 +662,7 @@ void checkAll();
#if !defined(SIMU) #if !defined(SIMU)
void getADC(); void getADC();
#define GET_ADC_IF_MIXER_NOT_RUNNING() do { if (s_pulses_paused) getADC(); } while(0) #define GET_ADC_IF_MIXER_NOT_RUNNING() do { if (s_pulses_paused) getADC(); } while(0)
#endif #endif
#include "sbus.h" #include "sbus.h"
@ -694,15 +690,15 @@ uint16_t isqrt32(uint32_t n);
#if !defined(BOOT) #if !defined(BOOT)
#include "tasks_arm.h" #include "tasks_arm.h"
extern OS_MutexID mixerMutex; extern RTOS_MUTEX_HANDLE mixerMutex;
inline void pauseMixerCalculations() inline void pauseMixerCalculations()
{ {
CoEnterMutexSection(mixerMutex); RTOS_LOCK_MUTEX(mixerMutex);
} }
inline void resumeMixerCalculations() inline void resumeMixerCalculations()
{ {
CoLeaveMutexSection(mixerMutex); RTOS_UNLOCK_MUTEX(mixerMutex);
} }
#else #else
#define pauseMixerCalculations() #define pauseMixerCalculations()

281
radio/src/rtos.h Normal file
View file

@ -0,0 +1,281 @@
/*
* 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.
*/
#ifndef _RTOS_H_
#define _RTOS_H_
#include "definitions.h"
#ifdef __cplusplus
extern "C++" {
#endif
#define doNothing() do { } while(0)
#if defined(SIMU)
#include <pthread.h>
#include <semaphore.h>
#if __GNUC__
#include <unistd.h>
inline void msleep(unsigned x)
{
usleep(1000 * x);
}
#else
#include <windows.h>
inline void msleep(unsigned x)
{
Sleep(x);
}
#endif
inline void RTOS_INIT()
{
}
inline void RTOS_START()
{
}
inline void RTOS_WAIT_MS(unsigned x)
{
msleep(x);
}
inline void RTOS_WAIT_TICKS(unsigned x)
{
msleep(x * 2);
}
typedef pthread_t RTOS_TASK_HANDLE;
typedef pthread_mutex_t RTOS_MUTEX_HANDLE;
typedef uint32_t RTOS_FLAG_HANDLE;
typedef sem_t * RTOS_EVENT_HANDLE;
#ifdef __cplusplus
inline void RTOS_CREATE_MUTEX(pthread_mutex_t &mutex)
{
mutex = PTHREAD_MUTEX_INITIALIZER;
}
inline void RTOS_LOCK_MUTEX(pthread_mutex_t &mutex)
{
pthread_mutex_lock(&mutex);
}
inline void RTOS_UNLOCK_MUTEX(pthread_mutex_t &mutex)
{
pthread_mutex_unlock(&mutex);
}
inline void RTOS_CREATE_FLAG(uint32_t &flag)
{
flag = 0; // TODO: real flags (use semaphores?)
}
inline void RTOS_SET_FLAG(uint32_t &flag)
{
flag = 1;
}
template<int SIZE>
class FakeTaskStack
{
public:
FakeTaskStack()
{
}
void paint()
{
}
uint16_t size()
{
return SIZE;
}
uint16_t available()
{
return SIZE / 2;
}
};
#define RTOS_DEFINE_STACK(name, size) FakeTaskStack<size> name
#define TASK_FUNCTION(task) void * task(void * pdata)
template<int SIZE>
inline void RTOS_CREATE_TASK(pthread_t &taskId, void * task(void *) , const char * name, FakeTaskStack<SIZE> &stack, unsigned stackSize, unsigned priority)
{
pthread_create(&taskId, nullptr, task, nullptr);
}
#define TASK_RETURN() return nullptr
constexpr uint16_t stackAvailable()
{
return 500;
}
#endif
// return 2ms resolution to match CoOS settings
inline uint32_t RTOS_GET_TIME(void)
{
extern uint64_t simuTimerMicros(void);
return simuTimerMicros() / 2000;
}
#elif defined(RTOS_COOS)
#ifdef __cplusplus
extern "C" {
#endif
#include <CoOS.h>
#ifdef __cplusplus
}
#endif
typedef OS_TID RTOS_TASK_HANDLE;
typedef OS_MutexID RTOS_MUTEX_HANDLE;
typedef OS_FlagID RTOS_FLAG_HANDLE;
typedef OS_EventID RTOS_EVENT_HANDLE;
static inline void RTOS_INIT()
{
CoInitOS();
}
static inline void RTOS_START()
{
CoStartOS();
}
static inline void RTOS_WAIT_MS(unsigned x)
{
CoTickDelay(x / 2);
}
static inline void RTOS_WAIT_TICKS(unsigned x)
{
CoTickDelay(x);
}
#define RTOS_CREATE_TASK(taskId, task, name, stackStruct, stackSize, priority) \
taskId = CoCreateTask(task, NULL, priority, &stackStruct.stack[stackSize-1], stackSize)
#ifdef __cplusplus
static inline void RTOS_CREATE_MUTEX(OS_MutexID &mutex)
{
mutex = CoCreateMutex();
}
static inline void RTOS_LOCK_MUTEX(OS_MutexID &mutex)
{
CoEnterMutexSection(mutex);
}
static inline void RTOS_UNLOCK_MUTEX(OS_MutexID &mutex)
{
CoLeaveMutexSection(mutex);
}
#endif
static inline uint16_t getStackAvailable(void * address, uint16_t size)
{
uint32_t * array = (uint32_t *)address;
uint16_t i = 0;
while (i < size && array[i] == 0x55555555) {
i++;
}
return i*4;
}
extern int _estack;
extern int _main_stack_start;
static inline uint16_t stackSize()
{
return ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
}
static inline uint16_t stackAvailable()
{
return getStackAvailable(&_main_stack_start, stackSize());
}
#define RTOS_CREATE_FLAG(flag) flag = CoCreateFlag(false, false)
#define RTOS_SET_FLAG(flag) (void)CoSetFlag(flag)
#ifdef __cplusplus
template<int SIZE>
class TaskStack
{
public:
TaskStack()
{
}
void paint()
{
for (uint32_t i=0; i<SIZE; i++) {
stack[i] = 0x55555555;
}
}
uint16_t size()
{
return SIZE * 4;
}
uint16_t available()
{
return getStackAvailable(stack, SIZE);
}
OS_STK stack[SIZE];
};
#endif // __cplusplus
static inline uint32_t RTOS_GET_TIME(void)
{
return CoGetOSTime();
}
#define RTOS_DEFINE_STACK(name, size) TaskStack<size> __ALIGNED(8) name // stack must be aligned to 8 bytes otherwise printf for %f does not work!
#define TASK_FUNCTION(task) void task(void * pdata)
#define TASK_RETURN() return
#else // no RTOS
static inline void RTOS_START()
{
}
static inline void RTOS_WAIT_MS(unsigned x)
{
}
static inline void RTOS_WAIT_TICKS(unsigned x)
{
}
#endif
#ifdef __cplusplus
}
#endif
#endif // _RTOS_H_

View file

@ -31,14 +31,14 @@
#endif #endif
#if defined(COLORLCD) #if defined(COLORLCD)
const pm_char vers_stamp[] PROGMEM = "VERS" TAB ": " "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")"; const pm_char vers_stamp[] = "VERS" TAB ": " "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
const pm_char date_stamp[] PROGMEM = "DATE" TAB ": " DATE; const pm_char date_stamp[] = "DATE" TAB ": " DATE;
const pm_char time_stamp[] PROGMEM = "TIME" TAB ": " TIME; const pm_char time_stamp[] = "TIME" TAB ": " TIME;
const pm_char eeprom_stamp[] PROGMEM = "EEPR" TAB ": " EEPROM_STR; const pm_char eeprom_stamp[] = "EEPR" TAB ": " EEPROM_STR;
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
const pm_char vers_stamp[] PROGMEM = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION " (" GIT_STR ")" "\036DATE\037\033: " DATE " " TIME "\036EEPR\037\033: " EEPROM_STR; const pm_char vers_stamp[] = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION " (" GIT_STR ")" "\036DATE\037\033: " DATE " " TIME "\036EEPR\037\033: " EEPROM_STR;
#else #else
const pm_char vers_stamp[] PROGMEM = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION "\036DATE\037\033: " DATE "\036TIME\037\033: " TIME "\036EEPR\037\033: " EEPROM_STR; const pm_char vers_stamp[] = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERSION "\036DATE\037\033: " DATE "\036TIME\037\033: " TIME "\036EEPR\037\033: " EEPROM_STR;
#endif #endif
/** /**

View file

@ -1250,10 +1250,10 @@ bool eeConvert()
const char *msg = NULL; const char *msg = NULL;
if (g_eeGeneral.version == 216) { if (g_eeGeneral.version == 216) {
msg = PSTR("EEprom Data v216"); msg = "EEprom Data v216";
} }
else if (g_eeGeneral.version == 217) { else if (g_eeGeneral.version == 217) {
msg = PSTR("EEprom Data v217"); msg = "EEprom Data v217";
} }
else { else {
return false; return false;

View file

@ -305,7 +305,7 @@ void eepromWriteWait(EepromWriteState state/* = EEPROM_IDLE*/)
while (eepromWriteState != state) { while (eepromWriteState != state) {
#if defined(STM32) #if defined(STM32)
// Waits a little bit for CS transitions // Waits a little bit for CS transitions
CoTickDelay(1/*2ms*/); RTOS_WAIT_MS(2);
#endif #endif
eepromWriteProcess(); eepromWriteProcess();
#ifdef SIMU #ifdef SIMU
@ -468,7 +468,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
} }
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
strcpy(statusLineMsg, PSTR("File ")); strcpy(statusLineMsg, "File ");
strcpy(statusLineMsg+5, &buf[sizeof(MODELS_PATH)]); strcpy(statusLineMsg+5, &buf[sizeof(MODELS_PATH)]);
#endif #endif

View file

@ -450,7 +450,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
logsClose(); logsClose();
// check and create folder here // check and create folder here
strcpy_P(buf, STR_MODELS_PATH); strcpy(buf, STR_MODELS_PATH);
const char * error = sdCheckAndCreateDirectory(buf); const char * error = sdCheckAndCreateDirectory(buf);
if (error) { if (error) {
return error; return error;
@ -476,7 +476,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
if (len == 0) { if (len == 0) {
uint8_t num = i_fileSrc + 1; uint8_t num = i_fileSrc + 1;
strcpy_P(&buf[sizeof(MODELS_PATH)], STR_MODEL); strcpy(&buf[sizeof(MODELS_PATH)], STR_MODEL);
buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL)] = (char)((num / 10) + '0'); buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL)] = (char)((num / 10) + '0');
buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 1] = (char)((num % 10) + '0'); buf[sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 1] = (char)((num % 10) + '0');
len = sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 2; len = sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 2;
@ -487,7 +487,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
len = tmp - buf; len = tmp - buf;
#endif #endif
strcpy_P(&buf[len], STR_MODELS_EXT); strcpy(&buf[len], STR_MODELS_EXT);
#ifdef SIMU #ifdef SIMU
TRACE("SD-card backup filename=%s", buf); TRACE("SD-card backup filename=%s", buf);
@ -532,10 +532,10 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
// we must close the logs as we reuse the same FIL structure // we must close the logs as we reuse the same FIL structure
logsClose(); logsClose();
strcpy_P(buf, STR_MODELS_PATH); strcpy(buf, STR_MODELS_PATH);
buf[sizeof(MODELS_PATH)-1] = '/'; buf[sizeof(MODELS_PATH)-1] = '/';
strcpy(&buf[sizeof(MODELS_PATH)], model_name); strcpy(&buf[sizeof(MODELS_PATH)], model_name);
strcpy_P(&buf[strlen(buf)], STR_MODELS_EXT); strcpy(&buf[strlen(buf)], STR_MODELS_EXT);
FRESULT result = f_open(&g_oLogFile, buf, FA_OPEN_EXISTING | FA_READ); FRESULT result = f_open(&g_oLogFile, buf, FA_OPEN_EXISTING | FA_READ);
if (result != FR_OK) { if (result != FR_OK) {

View file

@ -21,7 +21,7 @@
#include "opentx.h" #include "opentx.h"
#if !defined(BOOT) #if !defined(BOOT)
const pm_char s_charTab[] PROGMEM = "_-.,"; const pm_char s_charTab[] = "_-.,";
char hex2zchar(uint8_t hex) char hex2zchar(uint8_t hex)
{ {

View file

@ -747,8 +747,7 @@ void checkSwitches()
wdt_reset(); wdt_reset();
SIMU_SLEEP(1); RTOS_WAIT_MS(10);
CoTickDelay(10);
} }
LED_ERROR_END(); LED_ERROR_END();

View file

@ -95,9 +95,6 @@ extern "C" {
#define TIMER_MULT_APB1 2 #define TIMER_MULT_APB1 2
#define TIMER_MULT_APB2 2 #define TIMER_MULT_APB2 2
#define strcpy_P strcpy
#define strcat_P strcat
extern uint16_t sessionTimer; extern uint16_t sessionTimer;
#define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE) #define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE)

View file

@ -33,7 +33,7 @@
/* Lock / unlock functions */ /* Lock / unlock functions */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
#if !defined(BOOT) #if !defined(BOOT)
static OS_MutexID ioMutex; static RTOS_MUTEX_HANDLE ioMutex;
uint32_t ioMutexReq = 0, ioMutexRel = 0; uint32_t ioMutexReq = 0, ioMutexRel = 0;
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex) int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
{ {
@ -44,13 +44,14 @@ int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
int ff_req_grant (_SYNC_t mutex) int ff_req_grant (_SYNC_t mutex)
{ {
ioMutexReq += 1; ioMutexReq += 1;
return CoEnterMutexSection(mutex) == E_OK; RTOS_LOCK_MUTEX(mutex);
return 1;
} }
void ff_rel_grant (_SYNC_t mutex) void ff_rel_grant (_SYNC_t mutex)
{ {
ioMutexRel += 1; ioMutexRel += 1;
CoLeaveMutexSection(mutex); RTOS_UNLOCK_MUTEX(mutex);
} }
int ff_del_syncobj (_SYNC_t mutex) int ff_del_syncobj (_SYNC_t mutex)

View file

@ -49,7 +49,7 @@ uint32_t Peri1_frequency, Peri2_frequency;
GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpioi, gpioj; GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpioi, gpioj;
TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10; TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10;
RCC_TypeDef rcc; RCC_TypeDef rcc;
DMA_Stream_TypeDef dma1_stream2, dma1_stream5, dma1_stream7, dma2_stream1, dma2_stream2, dma2_stream5, dma2_stream6, dma2_stream7; DMA_Stream_TypeDef dma1_stream1, dma1_stream2, dma1_stream3, dma1_stream4, dma1_stream5, dma1_stream6, dma1_stream7, dma2_stream1, dma2_stream2, dma2_stream5, dma2_stream6, dma2_stream7;
DMA_TypeDef dma2; DMA_TypeDef dma2;
USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4; USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
SysTick_Type systick; SysTick_Type systick;
@ -105,7 +105,7 @@ uint64_t simuTimerMicros(void)
#else // GNUC #else // GNUC
auto now = std::chrono::steady_clock::now(); auto now = std::chrono::steady_clock::now();
return (U64) std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count(); return (uint64_t) std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count();
#endif #endif
} }
@ -121,7 +121,7 @@ uint16_t getTmr2MHz()
} }
// return 2ms resolution to match CoOS settings // return 2ms resolution to match CoOS settings
U64 CoGetOSTime(void) uint64_t CoGetOSTime(void)
{ {
return simuTimerMicros() / 2000; return simuTimerMicros() / 2000;
} }
@ -524,11 +524,6 @@ void StopAudioThread()
} }
#endif // #if defined(SIMU_AUDIO) #endif // #if defined(SIMU_AUDIO)
uint16_t stackAvailable()
{
return 500;
}
bool simuLcdRefresh = true; bool simuLcdRefresh = true;
display_t simuLcdBuf[DISPLAY_BUFFER_SIZE]; display_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
@ -666,18 +661,3 @@ void LCD_ControlLight(uint16_t dutyCycle) { }
void serialPrintf(const char * format, ...) { } void serialPrintf(const char * format, ...) { }
void serialCrlf() { } void serialCrlf() { }
void serialPutc(char c) { } void serialPutc(char c) { }
uint16_t stackSize() { return 0; }
void * start_routine(void * attr)
{
FUNCPtr task = (FUNCPtr)attr;
task(NULL);
return NULL;
}
OS_TID CoCreateTask(FUNCPtr task, void *argv, uint32_t parameter, void * stk, uint32_t stksize)
{
pthread_t tid;
pthread_create(&tid, NULL, start_routine, (void *)task);
return tid;
}

View file

@ -92,7 +92,7 @@ extern GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpio
extern TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10; extern TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10;
extern USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4; extern USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
extern RCC_TypeDef rcc; extern RCC_TypeDef rcc;
extern DMA_Stream_TypeDef dma1_stream2, dma1_stream5, dma1_stream7, dma2_stream1, dma2_stream2, dma2_stream5, dma2_stream6, dma2_stream7; extern DMA_Stream_TypeDef dma1_stream0, dma1_stream1, dma1_stream2, dma1_stream3, dma1_stream4, dma1_stream5, dma1_stream6, dma1_stream7, dma2_stream1, dma2_stream2, dma2_stream5, dma2_stream6, dma2_stream7;
extern DMA_TypeDef dma2; extern DMA_TypeDef dma2;
extern SysTick_Type systick; extern SysTick_Type systick;
#undef SysTick #undef SysTick
@ -147,7 +147,11 @@ extern SysTick_Type systick;
#define USART3 (&Usart3) #define USART3 (&Usart3)
#undef RCC #undef RCC
#define RCC (&rcc) #define RCC (&rcc)
#undef DMA1_Stream0
#undef DMA1_Stream1
#undef DMA1_Stream2 #undef DMA1_Stream2
#undef DMA1_Stream3
#undef DMA1_Stream4
#undef DMA1_Stream5 #undef DMA1_Stream5
#undef DMA1_Stream7 #undef DMA1_Stream7
#undef DMA2_Stream1 #undef DMA2_Stream1
@ -155,7 +159,11 @@ extern SysTick_Type systick;
#undef DMA2_Stream5 #undef DMA2_Stream5
#undef DMA2_Stream6 #undef DMA2_Stream6
#undef DMA2_Stream7 #undef DMA2_Stream7
#define DMA1_Stream0 (&dma1_stream0)
#define DMA1_Stream1 (&dma1_stream1)
#define DMA1_Stream2 (&dma1_stream2) #define DMA1_Stream2 (&dma1_stream2)
#define DMA1_Stream3 (&dma1_stream3)
#define DMA1_Stream4 (&dma1_stream4)
#define DMA1_Stream5 (&dma1_stream5) #define DMA1_Stream5 (&dma1_stream5)
#define DMA1_Stream7 (&dma1_stream7) #define DMA1_Stream7 (&dma1_stream7)
#define DMA2_Stream1 (&dma2_stream1) #define DMA2_Stream1 (&dma2_stream1)
@ -213,117 +221,6 @@ extern uint32_t txPdcUsart( uint8_t *buffer, uint32_t size );
extern uint32_t txPdcPending(); extern uint32_t txPdcPending();
extern void rxPdcUsart( void (*pChProcess)(uint8_t x) ); extern void rxPdcUsart( void (*pChProcess)(uint8_t x) );
#define loop_until_bit_is_set( port, bitnum) \
while ( 0/*! ( (port) & (1 << (bitnum)) )*/ ) ;
#define PROGMEM
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
#define pgm_read_word(address_short) (*(uint16_t*)(address_short))
#define pgm_read_adr(address_short) *address_short
#define pgm_read_stringP(adr) ((adr))
#define PSTR(adr) adr
#define _delay_us(a)
#define _delay_ms(a)
#define cli()
#define sei()
#define strcpy_P strcpy
#define strcat_P strcat
#define memcpy_P memcpy
#define PORTA dummyport
#define PORTB portb
#define PORTC portc
#define PORTD dummyport
#define PORTE dummyport
#define PORTF dummyport
#define PORTG dummyport
#define PORTH porth
#define PORTL dummyport
#define DDRA dummyport
#define DDRB dummyport
#define DDRC dummyport
#define DDRD dummyport
#define DDRE dummyport
#define DDRF dummyport
#define DDRG dummyport
#define EEMEM
#define UCSR0B dummyport
#define UDRIE0 dummyport
#define TXB80 dummyport
#define TXCIE0 dummyport
#define TXEN0 dummyport
#define RXEN0 dummyport
#define DDE0 dummyport
#define PORTE0 dummyport
#define RXCIE0 dummyport
#define OCR0A dummyport
#define OCR1A dummyport16
#define OCR1B dummyport16
#define OCR1C dummyport16
#define OCR2 dummyport
#define OCR3A dummyport16
#define OCR3B dummyport16
#define OCR4A dummyport
#define OCR5A dummyport
#define TCCR0A dummyport
#define TCCR1A dummyport
#define TCCR1B dummyport
#define TCCR1C dummyport
#define COM1B0 dummyport
#define COM0A0 dummyport
#define TCNT1 dummyport16
#define TCNT1L dummyport
#define TCNT5 dummyport16
#define ICR1 dummyport16
#define TIFR dummyport
#define TIFR1 dummyport
#define ETIFR dummyport
#define SPDR dummyport
#define SPSR dummyport
#define SPIF dummyport
#define SPCR dummyport
#define TIMSK dummyport
#define TIMSK1 dummyport
#define TIMSK3 dummyport
#define TIMSK4 dummyport
#define TIMSK5 dummyport
#define ETIMSK dummyport
#define ETIMSK1 dummyport
#define UCSZ02 dummyport
#define UCSR0C dummyport
#define UCSZ01 dummyport
#define UCSZ00 dummyport
#define UCSR0A dummyport
#define RXC0 dummyport
#define UDR0 dummyport
#define OCIE1A dummyport
#define OCIE1B dummyport
#define OCIE1C dummyport
#define OCIE4A dummyport
#define OCIE5A dummyport
#define OUT_B_LIGHT 7
#define INP_E_ElevDR 2
#define INP_E_Trainer 5
#define INP_E_Gear 4
#define INP_C_ThrCt 6
#define INP_C_AileDR 7
#define INP_E_ID2 6
#define WGM10 0
#define WGM12 0
#define COM1B1 0
#define FOC1B 0
#define CS10 0
#define DOR0 0
#define UPE0 0
#define FE0 0
#define ISR(x, ...) void x() #define ISR(x, ...) void x()
#if !defined(_MSC_VER) && defined(__GNUC__) #if !defined(_MSC_VER) && defined(__GNUC__)
@ -345,7 +242,6 @@ extern char * main_thread_error;
#define getADC() #define getADC()
#define GET_ADC_IF_MIXER_NOT_RUNNING() #define GET_ADC_IF_MIXER_NOT_RUNNING()
#define getADC_bandgap()
#define SIMU_SLEEP(x) do { if (!main_thread_running) return; sleep(x/*ms*/); } while (0) #define SIMU_SLEEP(x) do { if (!main_thread_running) return; sleep(x/*ms*/); } while (0)
#define SIMU_SLEEP_NORET(x) do { sleep(x/*ms*/); } while (0) #define SIMU_SLEEP_NORET(x) do { sleep(x/*ms*/); } while (0)
@ -370,49 +266,12 @@ void StopEepromThread();
#define StopAudioThread() #define StopAudioThread()
#endif #endif
#define OS_MutexID pthread_mutex_t
extern OS_MutexID audioMutex;
#define OS_FlagID uint32_t
#define OS_TID pthread_t
#define OS_TCID uint32_t
#define OS_STK uint32_t
#define E_OK 0
#define WDRF 0
void * simuMain(void * args = NULL); void * simuMain(void * args = NULL);
extern uint8_t MCUCSR, MCUSR, MCUCR;
typedef unsigned int U32;
typedef unsigned long long U64;
typedef void (*FUNCPtr)(void*);
#define CoInitOS(...)
#define CoStartOS(...)
OS_TID CoCreateTask(FUNCPtr task, void *argv, uint32_t parameter, void * stk, uint32_t stksize);
#define CoCreateTaskEx(...) 0
#define CoCreateMutex(...) PTHREAD_MUTEX_INITIALIZER
#define CoEnterMutexSection(m) pthread_mutex_lock(&(m))
#define CoLeaveMutexSection(m) pthread_mutex_unlock(&(m))
#define CoSetFlag(...)
#define CoClearFlag(...)
#define CoSetTmrCnt(...)
#define CoEnterISR(...)
#define CoExitISR(...)
#define CoStartTmr(...)
#define CoWaitForSingleFlag(...) 0
#define CoTickDelay(x) sleep(2*(x))
#define CoCreateFlag(...) 0
U64 CoGetOSTime(void);
#define UART_Stop(...) #define UART_Stop(...)
#define UART3_Stop(...) #define UART3_Stop(...)
#define USART_GetITStatus(...) 0 #define USART_GetITStatus(...) 0
#define USART_ClearFlag(...)
#if defined(STM32) #if defined(STM32)
inline void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { } inline void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { }
@ -437,6 +296,7 @@ inline void DMA_Init(DMA_Stream_TypeDef* DMAy_Streamx, DMA_InitTypeDef* DMA_Init
inline void DMA_ITConfig(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState) { } inline void DMA_ITConfig(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState) { }
inline void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct) { } inline void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct) { }
inline void DMA_Cmd(DMA_Stream_TypeDef* DMAy_Streamx, FunctionalState NewState) { } inline void DMA_Cmd(DMA_Stream_TypeDef* DMAy_Streamx, FunctionalState NewState) { }
void DMACopy(void * src, void * dest, unsigned size);
inline FlagStatus DMA_GetFlagStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_FLAG) { return RESET; } inline FlagStatus DMA_GetFlagStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_FLAG) { return RESET; }
inline ITStatus DMA_GetITStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT) { return RESET; } inline ITStatus DMA_GetITStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT) { return RESET; }
inline void DMA_ClearITPendingBit(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT) { } inline void DMA_ClearITPendingBit(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT) { }

View file

@ -29,7 +29,7 @@
FILE * diskImage = 0; FILE * diskImage = 0;
FATFS g_FATFS_Obj = {0}; FATFS g_FATFS_Obj = {0};
OS_MutexID ioMutex; RTOS_MUTEX_HANDLE ioMutex;
int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj) /* Create a sync object */ int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj) /* Create a sync object */
{ {

View file

@ -86,7 +86,7 @@ void btSendBuffer()
btTx.buffer = btTxBuffer; btTx.buffer = btTxBuffer;
txPdcBt(&btTx); txPdcBt(&btTx);
while (btTx.ready == 1) { while (btTx.ready == 1) {
CoTickDelay(1); // 2ms for now RTOS_WAIT_TICKS(1);
} }
btTx.size = 0; btTx.size = 0;
} }
@ -131,7 +131,7 @@ uint32_t btChangeBaudrate( uint32_t baudIndex )
} }
} }
else { else {
CoTickDelay(1) ; // 2mS RTOS_WAIT_TICKS(1);
} }
} }
@ -167,7 +167,7 @@ uint32_t btPollDevice()
} }
} }
else { else {
CoTickDelay(1) ; // 2mS RTOS_WAIT_TICKS(1) ; // 2mS
} }
} }
@ -229,7 +229,7 @@ void bluetoothTask(void * pdata)
x = 0 ; x = 0 ;
} }
btSetBaudrate(x) ; btSetBaudrate(x) ;
CoTickDelay(1) ; // 2mS RTOS_WAIT_TICKS(1) ; // 2mS
btStatus = btPollDevice() ; // Do we get a response? btStatus = btPollDevice() ; // Do we get a response?
} }
} }
@ -248,7 +248,7 @@ void bluetoothTask(void * pdata)
btInit(); btInit();
} }
CoTickDelay(1) ; RTOS_WAIT_TICKS(1) ;
btPollDevice(); // Do we get a response? btPollDevice(); // Do we get a response?

View file

@ -223,9 +223,6 @@ extern uint8_t temperature ; // Raw temp reading
extern uint8_t maxTemperature ; // Raw temp reading extern uint8_t maxTemperature ; // Raw temp reading
uint8_t getTemperature(); uint8_t getTemperature();
#define strcpy_P strcpy
#define strcat_P strcat
#if !defined(REVA) #if !defined(REVA)
extern uint16_t Current_analogue; extern uint16_t Current_analogue;
extern uint16_t Current_max; extern uint16_t Current_max;

View file

@ -79,7 +79,7 @@ uint32_t transSpeed;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
#if !defined(BOOT) #if !defined(BOOT)
static OS_MutexID ioMutex; static RTOS_MUTEX_HANDLE ioMutex;
volatile int mutexCheck = 0; volatile int mutexCheck = 0;
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex) int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
{ {
@ -89,7 +89,7 @@ int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
int ff_req_grant (_SYNC_t mutex) int ff_req_grant (_SYNC_t mutex)
{ {
CoEnterMutexSection(mutex); RTOS_LOCK_MUTEX(mutex);
return 1; return 1;
} }
@ -676,7 +676,7 @@ const char * sdIdentify()
* The host that does not support CMD8 shall supply high voltage range... */ * The host that does not support CMD8 shall supply high voltage range... */
result = sdCmd8(1); result = sdCmd8(1);
if (result == 0) f8 = 1; if (result == 0) f8 = 1;
else if (result == SD_NORESPONSE) CoTickDelay(1); /* 2ms delay after "no response" */ else if (result == SD_NORESPONSE) RTOS_WAIT_MS(2); /* 2ms delay after "no response" */
else return "Identify.8 error"; else return "Identify.8 error";
#if 0 #if 0
@ -956,7 +956,7 @@ void sdInit()
} }
sdCmd0(); sdCmd0();
CoTickDelay(5); // 10ms RTOS_WAIT_MS(10); // 10ms
sdCmd8(1); sdCmd8(1);
#if 0 #if 0
@ -971,7 +971,7 @@ void sdInit()
uint8_t retry; uint8_t retry;
for (retry=0; retry<10; retry++) { for (retry=0; retry<10; retry++) {
if (!sdCmd2()) break; if (!sdCmd2()) break;
CoTickDelay(1); // 2ms RTOS_WAIT_MS(2); // 2ms
} }
if (retry == 10) { if (retry == 10) {
@ -982,7 +982,7 @@ void sdInit()
for (retry=0; retry<10; retry++) { for (retry=0; retry<10; retry++) {
if (!sdCmd3()) break; if (!sdCmd3()) break;
CoTickDelay(1); // 2ms RTOS_WAIT_MS(2); // 2ms
} }
if (retry == 10) { if (retry == 10) {

View file

@ -107,10 +107,10 @@ extern "C" void INTERRUPT_xMS_IRQHandler()
#endif #endif
#if (defined(PCBX9E) && !defined(SIMU)) #if (defined(PCBX9E) && !defined(SIMU))
const pm_uchar bmp_startup[] PROGMEM = { const pm_uchar bmp_startup[] = {
#include "startup.lbm" #include "startup.lbm"
}; };
const pm_uchar bmp_lock[] PROGMEM = { const pm_uchar bmp_lock[] = {
#include "lock.lbm" #include "lock.lbm"
}; };
#endif #endif

View file

@ -106,9 +106,6 @@ extern "C" {
#define TIMER_MULT_APB1 2 #define TIMER_MULT_APB1 2
#define TIMER_MULT_APB2 2 #define TIMER_MULT_APB2 2
#define strcpy_P strcpy
#define strcat_P strcat
extern uint16_t sessionTimer; extern uint16_t sessionTimer;
// Board driver // Board driver

View file

@ -60,7 +60,7 @@
/* Lock / unlock functions */ /* Lock / unlock functions */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
#if !defined(BOOT) #if !defined(BOOT)
static OS_MutexID ioMutex; static RTOS_MUTEX_HANDLE ioMutex;
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex) int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
{ {
@ -70,12 +70,13 @@ int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
int ff_req_grant (_SYNC_t mutex) int ff_req_grant (_SYNC_t mutex)
{ {
return CoEnterMutexSection(mutex) == E_OK; RTOS_LOCK_MUTEX(mutex);
return 1;
} }
void ff_rel_grant (_SYNC_t mutex) void ff_rel_grant (_SYNC_t mutex)
{ {
CoLeaveMutexSection(mutex); RTOS_UNLOCK_MUTEX(mutex);
} }
int ff_del_syncobj (_SYNC_t mutex) int ff_del_syncobj (_SYNC_t mutex)

View file

@ -20,18 +20,17 @@
#include "opentx.h" #include "opentx.h"
OS_TID menusTaskId; RTOS_TASK_HANDLE menusTaskId;
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work! RTOS_DEFINE_STACK(menusStack, MENUS_STACK_SIZE);
TaskStack<MENUS_STACK_SIZE> __ALIGNED(8) menusStack;
OS_TID mixerTaskId; RTOS_TASK_HANDLE mixerTaskId;
TaskStack<MIXER_STACK_SIZE> mixerStack; RTOS_DEFINE_STACK(mixerStack, MIXER_STACK_SIZE);
OS_TID audioTaskId; RTOS_TASK_HANDLE audioTaskId;
TaskStack<AUDIO_STACK_SIZE> audioStack; RTOS_DEFINE_STACK(audioStack, AUDIO_STACK_SIZE);
OS_MutexID audioMutex; RTOS_MUTEX_HANDLE audioMutex;
OS_MutexID mixerMutex; RTOS_MUTEX_HANDLE mixerMutex;
enum TaskIndex { enum TaskIndex {
MENU_TASK_INDEX, MENU_TASK_INDEX,
@ -43,27 +42,6 @@ enum TaskIndex {
MAIN_TASK_INDEX = 255 MAIN_TASK_INDEX = 255
}; };
template<int SIZE>
void TaskStack<SIZE>::paint()
{
for (uint32_t i=0; i<SIZE; i++) {
stack[i] = 0x55555555;
}
}
uint16_t getStackAvailable(void * address, uint16_t size)
{
uint32_t * array = (uint32_t *)address;
uint16_t i = 0;
while (i < size && array[i] == 0x55555555) {
i++;
}
return i*4;
#if defined(CLI)
cliStackPaint();
#endif
}
void stackPaint() void stackPaint()
{ {
menusStack.paint(); menusStack.paint();
@ -74,18 +52,6 @@ void stackPaint()
#endif #endif
} }
#if defined(STM32) && !defined(SIMU)
uint16_t stackSize()
{
return ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
}
uint16_t stackAvailable()
{
return getStackAvailable(&_main_stack_start, stackSize());
}
#endif
volatile uint16_t timeForcePowerOffPressed = 0; volatile uint16_t timeForcePowerOffPressed = 0;
bool isForcePowerOffRequested() bool isForcePowerOffRequested()
@ -109,7 +75,7 @@ bool isForcePowerOffRequested()
uint32_t nextMixerTime[NUM_MODULES]; uint32_t nextMixerTime[NUM_MODULES];
void mixerTask(void * pdata) TASK_FUNCTION(mixerTask)
{ {
static uint32_t lastRunTime; static uint32_t lastRunTime;
s_pulses_paused = true; s_pulses_paused = true;
@ -118,20 +84,20 @@ void mixerTask(void * pdata)
#if defined(SIMU) #if defined(SIMU)
if (main_thread_running == 0) if (main_thread_running == 0)
return; TASK_RETURN();
#endif #endif
#if defined(SBUS) #if defined(SBUS)
processSbusInput(); processSbusInput();
#endif #endif
CoTickDelay(1); RTOS_WAIT_TICKS(1);
if (isForcePowerOffRequested()) { if (isForcePowerOffRequested()) {
pwrOff(); pwrOff();
} }
uint32_t now = CoGetOSTime(); uint32_t now = RTOS_GET_TIME();
bool run = false; bool run = false;
#if !defined(SIMU) && defined(STM32) #if !defined(SIMU) && defined(STM32)
if ((now - lastRunTime) >= (usbStarted() ? 5 : 10)) { // run at least every 20ms (every 10ms if USB is active) if ((now - lastRunTime) >= (usbStarted() ? 5 : 10)) { // run at least every 20ms (every 10ms if USB is active)
@ -158,11 +124,11 @@ void mixerTask(void * pdata)
uint16_t t0 = getTmr2MHz(); uint16_t t0 = getTmr2MHz();
DEBUG_TIMER_START(debugTimerMixer); DEBUG_TIMER_START(debugTimerMixer);
CoEnterMutexSection(mixerMutex); RTOS_LOCK_MUTEX(mixerMutex);
doMixerCalculations(); doMixerCalculations();
DEBUG_TIMER_START(debugTimerMixerCalcToUsage); DEBUG_TIMER_START(debugTimerMixerCalcToUsage);
DEBUG_TIMER_SAMPLE(debugTimerMixerIterval); DEBUG_TIMER_SAMPLE(debugTimerMixerIterval);
CoLeaveMutexSection(mixerMutex); RTOS_UNLOCK_MUTEX(mixerMutex);
DEBUG_TIMER_STOP(debugTimerMixer); DEBUG_TIMER_STOP(debugTimerMixer);
#if defined(STM32) && !defined(SIMU) #if defined(STM32) && !defined(SIMU)
@ -196,7 +162,7 @@ void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms)
{ {
// Schedule next mixer calculation time, // Schedule next mixer calculation time,
// for now assume mixer calculation takes 2 ms. // for now assume mixer calculation takes 2 ms.
nextMixerTime[module] = (uint32_t)CoGetOSTime() + period_ms / 2 - 1/*2ms*/; nextMixerTime[module] = (uint32_t)RTOS_GET_TIME() + period_ms / 2 - 1/*2ms*/;
DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage); DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage);
} }
@ -206,7 +172,7 @@ void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms)
bool perMainEnabled = true; bool perMainEnabled = true;
#endif #endif
void menusTask(void * pdata) TASK_FUNCTION(menusTask)
{ {
opentxInit(); opentxInit();
@ -217,13 +183,13 @@ void menusTask(void * pdata)
break; break;
} }
else if (pwr_check == e_power_press) { else if (pwr_check == e_power_press) {
CoTickDelay(MENU_TASK_PERIOD_TICKS); RTOS_WAIT_TICKS(MENU_TASK_PERIOD_TICKS);
continue; continue;
} }
#else #else
while (pwrCheck() != e_power_off) { while (pwrCheck() != e_power_off) {
#endif #endif
uint32_t start = (uint32_t)CoGetOSTime(); uint32_t start = (uint32_t)RTOS_GET_TIME();
DEBUG_TIMER_START(debugTimerPerMain); DEBUG_TIMER_START(debugTimerPerMain);
#if defined(COLORLCD) && defined(CLI) #if defined(COLORLCD) && defined(CLI)
if (perMainEnabled) { if (perMainEnabled) {
@ -234,11 +200,11 @@ void menusTask(void * pdata)
#endif #endif
DEBUG_TIMER_STOP(debugTimerPerMain); DEBUG_TIMER_STOP(debugTimerPerMain);
// TODO remove completely massstorage from sky9x firmware // TODO remove completely massstorage from sky9x firmware
uint32_t runtime = ((uint32_t)CoGetOSTime() - start); uint32_t runtime = ((uint32_t)RTOS_GET_TIME() - start);
// deduct the thread run-time from the wait, if run-time was more than // deduct the thread run-time from the wait, if run-time was more than
// desired period, then skip the wait all together // desired period, then skip the wait all together
if (runtime < MENU_TASK_PERIOD_TICKS) { if (runtime < MENU_TASK_PERIOD_TICKS) {
CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime); RTOS_WAIT_TICKS(MENU_TASK_PERIOD_TICKS - runtime);
} }
resetForcePowerOffRequest(); resetForcePowerOffRequest();
@ -260,26 +226,27 @@ void menusTask(void * pdata)
drawSleepBitmap(); drawSleepBitmap();
opentxClose(); opentxClose();
boardOff(); // Only turn power off if necessary boardOff(); // Only turn power off if necessary
TASK_RETURN();
} }
void tasksStart() void tasksStart()
{ {
CoInitOS(); RTOS_INIT();
#if defined(CLI) #if defined(CLI)
cliStart(); cliStart();
#endif #endif
mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack.stack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE); RTOS_CREATE_TASK(mixerTaskId, mixerTask, "Mixer", mixerStack, MIXER_STACK_SIZE, MIXER_TASK_PRIO);
menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack.stack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE); RTOS_CREATE_TASK(menusTaskId, menusTask, "Menus", menusStack, MENUS_STACK_SIZE, MENUS_TASK_PRIO);
#if !defined(SIMU) #if !defined(SIMU)
// TODO move the SIMU audio in this task RTOS_CREATE_TASK(audioTaskId, audioTask, "Audio", audioStack, AUDIO_STACK_SIZE, AUDIO_TASK_PRIO);
audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack.stack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);
#endif #endif
audioMutex = CoCreateMutex(); RTOS_CREATE_MUTEX(audioMutex);
mixerMutex = CoCreateMutex(); RTOS_CREATE_MUTEX(mixerMutex);
CoStartOS(); RTOS_START();
} }

View file

@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * Based on code named
* th9x - http://code.google.com/p/th9x * th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * gruvin9x - http://code.google.com/p/gruvin9x
* *
@ -21,53 +21,37 @@
#ifndef _TASKS_ARM_H_ #ifndef _TASKS_ARM_H_
#define _TASKS_ARM_H_ #define _TASKS_ARM_H_
#if !defined(SIMU) #include "rtos.h"
extern "C" {
#include <CoOS.h>
}
#endif
// stack sizes should be in multiples of 8 for better alignment
#define MENUS_STACK_SIZE 2000 #define MENUS_STACK_SIZE 2000
#define MIXER_STACK_SIZE 500 #define MIXER_STACK_SIZE 512
#define AUDIO_STACK_SIZE 500 #define AUDIO_STACK_SIZE 512
#define BLUETOOTH_STACK_SIZE 500
uint16_t getStackAvailable(void * address, uint16_t size); #define MIXER_TASK_PRIO 5
#define AUDIO_TASK_PRIO 7
#define MENUS_TASK_PRIO 10
#define CLI_TASK_PRIO 10
template<int SIZE> extern RTOS_TASK_HANDLE menusTaskId;
class TaskStack extern RTOS_DEFINE_STACK(menusStack, MENUS_STACK_SIZE);
{
public: extern RTOS_TASK_HANDLE mixerTaskId;
TaskStack() { } extern RTOS_DEFINE_STACK(mixerStack, MIXER_STACK_SIZE);
void paint();
uint16_t size() extern RTOS_TASK_HANDLE audioTaskId;
{ extern RTOS_DEFINE_STACK(audioStack, AUDIO_STACK_SIZE);
return SIZE * 4;
} extern RTOS_MUTEX_HANDLE mixerMutex;
uint16_t available() extern RTOS_FLAG_HANDLE openTxInitCompleteFlag;
{
return getStackAvailable(stack, SIZE);
}
OS_STK stack[SIZE];
};
void stackPaint(); void stackPaint();
uint16_t stackSize();
uint16_t stackAvailable();
extern OS_TID menusTaskId;
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work!
extern TaskStack<MENUS_STACK_SIZE> _ALIGNED(8) menusStack;
extern OS_TID mixerTaskId;
extern TaskStack<MIXER_STACK_SIZE> mixerStack;
extern OS_TID audioTaskId;
extern TaskStack<AUDIO_STACK_SIZE> audioStack;
void tasksStart(); void tasksStart();
extern volatile uint16_t timeForcePowerOffPressed; extern volatile uint16_t timeForcePowerOffPressed;
inline void resetForcePowerOffRequest() {timeForcePowerOffPressed = 0; } inline void resetForcePowerOffRequest()
{
timeForcePowerOffPressed = 0;
}
#endif // _TASKS_ARM_H_ #endif // _TASKS_ARM_H_

View file

@ -21,6 +21,8 @@
#ifndef _FATFS #ifndef _FATFS
#define _FATFS 68020 /* Revision ID */ #define _FATFS 68020 /* Revision ID */
#include "rtos.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -2,6 +2,8 @@
/ FatFs - FAT file system module configuration file / FatFs - FAT file system module configuration file
/---------------------------------------------------------------------------*/ /---------------------------------------------------------------------------*/
#include "rtos.h"
#define _FFCONF 68020 /* Revision ID */ #define _FFCONF 68020 /* Revision ID */
#if !defined(SIMU) #if !defined(SIMU)
@ -263,7 +265,7 @@ extern "C" {
#if !defined(BOOT) #if !defined(BOOT)
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */ #define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
#define _SYNC_t unsigned char /*OS_MutexID*/ /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */ #define _SYNC_t RTOS_MUTEX_HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
#else #else
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */ #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -856,7 +856,7 @@ extern const pm_char STR_BLCOLOR[];
extern const pm_char STR_TELEMETRY_SENSORS[]; extern const pm_char STR_TELEMETRY_SENSORS[];
extern const pm_char STR_VALUE[]; extern const pm_char STR_VALUE[];
extern const pm_char STR_TOPLCDTIMER[]; extern const pm_char STR_TOPLCDTIMER[];
extern const pm_char STR_UNIT[] PROGMEM; extern const pm_char STR_UNIT[] ;
extern const pm_char STR_TELEMETRY_NEWSENSOR[]; extern const pm_char STR_TELEMETRY_NEWSENSOR[];
extern const pm_char STR_ID[]; extern const pm_char STR_ID[];
extern const pm_char STR_PRECISION[]; extern const pm_char STR_PRECISION[];

View file

@ -31,7 +31,7 @@ def modifyDeclaration(constant, after):
def modifyDefinition(constant, after): def modifyDefinition(constant, after):
newline = "const pm_char S" + constant + "[] PROGMEM = " + constant + ";" newline = "const pm_char S" + constant + "[] = " + constant + ";"
filename = "translations.cpp" filename = "translations.cpp"
addLine(filename, newline, after + "[] ") addLine(filename, newline, after + "[] ")

View file

@ -15,7 +15,7 @@ cw = open(filename + ".stringsc", "w")
replacements = {} replacements = {}
for line in fr.readlines(): for line in fr.readlines():
pos_pstr = line.find("PSTR(\"") pos_pstr = line.find("\""
MENU = False MENU = False
if pos_pstr < 0: if pos_pstr < 0:
pos_pstr = line.find("MENU(\"") pos_pstr = line.find("MENU(\"")
@ -53,10 +53,10 @@ for line in fr.readlines():
replacements[str_rep] = pstr replacements[str_rep] = pstr
print(glob_str, "=>", pstr, str_rep) print(glob_str, "=>", pstr, str_rep)
ew.write("#define " + str_rep[1:] + " " * (17 - len(str_rep)) + '"%s"\n' % pstr) ew.write("#define " + str_rep[1:] + " " * (17 - len(str_rep)) + '"%s"\n' % pstr)
hw.write("extern const PROGMEM char %s[];\n" % str_rep) hw.write("extern const char %s[];\n" % str_rep)
cw.write("const prog_char APM %s[] = %s;\n" % (str_rep, str_rep[1:])) cw.write("const prog_char APM %s[] = %s;\n" % (str_rep, str_rep[1:]))
pos_pstr = line.find("PSTR(\"") pos_pstr = line.find("\""
fw.write(line) fw.write(line)