Merge pull request #6087 from opentx/rtos_and_align_macros
Rtos and align macros
This commit is contained in:
@@ -40,7 +40,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
|
||||
int modesCount = firmware->getCapability(FlightModes);
|
||||
|
||||
// Phase name
|
||||
// Flight mode name
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
if (modesCount) {
|
||||
ui->name->setValidator(new QRegExpValidator(rx, this));
|
||||
@@ -51,7 +51,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
ui->name->setDisabled(true);
|
||||
}
|
||||
|
||||
// Phase switch
|
||||
// Flight mode switch
|
||||
if (phaseIdx > 0) {
|
||||
ui->swtch->setModel(switchModel);
|
||||
connect(ui->swtch, SIGNAL(activated(int)), this, SLOT(phaseSwitchChanged(int)));
|
||||
|
||||
@@ -430,10 +430,12 @@ if(NOT MSVC)
|
||||
|
||||
# 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")
|
||||
|
||||
if(SEMIHOSTING)
|
||||
add_definitions(-DSEMIHOSTING)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
|
||||
endif()
|
||||
|
||||
# Use newlib nano, which saves a few kilobytes.
|
||||
if(NOT NANO STREQUAL NO)
|
||||
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)
|
||||
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)
|
||||
add_subdirectory(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()
|
||||
|
||||
add_definitions(-DRTOS_COOS)
|
||||
|
||||
add_executable(firmware ${SRC} ${FIRMWARE_HEADERS})
|
||||
link_libraries(firmware -lstdc++)
|
||||
add_dependencies(firmware ${FIRMWARE_DEPENDENCIES})
|
||||
|
||||
+25
-25
@@ -21,7 +21,7 @@
|
||||
#include "opentx.h"
|
||||
#include <math.h>
|
||||
|
||||
extern OS_MutexID audioMutex;
|
||||
extern RTOS_MUTEX_HANDLE audioMutex;
|
||||
|
||||
const int16_t sineValues[] =
|
||||
{
|
||||
@@ -223,7 +223,7 @@ const char * const audioFilenames[] = {
|
||||
};
|
||||
|
||||
BitField<(AU_SPECIAL_SOUND_FIRST)> sdAvailableSystemAudioFiles;
|
||||
BitField<(MAX_FLIGHT_MODES * 2/*on, off*/)> sdAvailablePhaseAudioFiles;
|
||||
BitField<(MAX_FLIGHT_MODES * 2/*on, off*/)> sdAvailableFlightmodeAudioFiles;
|
||||
BitField<(SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT)> sdAvailableSwitchAudioFiles;
|
||||
BitField<(MAX_LOGICAL_SWITCHES * 2/*on, off*/)> sdAvailableLogicalSwitchAudioFiles;
|
||||
|
||||
@@ -294,10 +294,10 @@ char * getModelAudioPath(char * path)
|
||||
return result;
|
||||
}
|
||||
|
||||
void getPhaseAudioFile(char * filename, int index, unsigned int event)
|
||||
void getFlightmodeAudioFile(char * filename, int index, unsigned int event)
|
||||
{
|
||||
char * str = getModelAudioPath(filename);
|
||||
char * tmp = strcat_phasename(str, index);
|
||||
char * tmp = strcatFlightmodeName(str, index);
|
||||
strcpy(tmp, suffixes[event]);
|
||||
strcat(tmp, SOUNDS_EXT);
|
||||
}
|
||||
@@ -360,7 +360,7 @@ void referenceModelAudioFiles()
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
|
||||
sdAvailablePhaseAudioFiles.reset();
|
||||
sdAvailableFlightmodeAudioFiles.reset();
|
||||
sdAvailableSwitchAudioFiles.reset();
|
||||
sdAvailableLogicalSwitchAudioFiles.reset();
|
||||
|
||||
@@ -379,13 +379,13 @@ void referenceModelAudioFiles()
|
||||
if (len < 5 || strcasecmp(fno.fname+len-4, SOUNDS_EXT) || (fno.fattrib & AM_DIR)) continue;
|
||||
TRACE("referenceModelAudioFiles(): using file: %s", fno.fname);
|
||||
|
||||
// Phases Audio Files <phasename>-[on|off].wav
|
||||
// Flight modes Audio Files <flightmodename>-[on|off].wav
|
||||
for (int i=0; i<MAX_FLIGHT_MODES && !found; i++) {
|
||||
for (int event=0; event<2; event++) {
|
||||
getPhaseAudioFile(path, i, event);
|
||||
getFlightmodeAudioFile(path, i, event);
|
||||
// TRACE("referenceModelAudioFiles(): searching for %s in %s", filename, fno.fname);
|
||||
if (!strcasecmp(filename, fno.fname)) {
|
||||
sdAvailablePhaseAudioFiles.setBit(INDEX_PHASE_AUDIO_FILE(i, event));
|
||||
sdAvailableFlightmodeAudioFiles.setBit(INDEX_PHASE_AUDIO_FILE(i, event));
|
||||
found = true;
|
||||
TRACE("\tfound: %s", filename);
|
||||
break;
|
||||
@@ -437,8 +437,8 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
|
||||
}
|
||||
}
|
||||
else if (category == PHASE_AUDIO_CATEGORY) {
|
||||
if (sdAvailablePhaseAudioFiles.getBit(INDEX_PHASE_AUDIO_FILE(index, event))) {
|
||||
getPhaseAudioFile(filename, index, event);
|
||||
if (sdAvailableFlightmodeAudioFiles.getBit(INDEX_PHASE_AUDIO_FILE(index, event))) {
|
||||
getFlightmodeAudioFile(filename, index, event);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -508,14 +508,14 @@ AudioQueue::AudioQueue()
|
||||
void audioTask(void * pdata)
|
||||
{
|
||||
while (!audioQueue.started()) {
|
||||
CoTickDelay(1);
|
||||
RTOS_WAIT_TICKS(1);
|
||||
}
|
||||
|
||||
setSampleRate(AUDIO_SAMPLE_RATE);
|
||||
|
||||
#if defined(PCBX12S)
|
||||
// The audio amp needs ~2s to start
|
||||
CoTickDelay(500); // 1s
|
||||
RTOS_WAIT_MS(1000); // 1s
|
||||
#endif
|
||||
|
||||
if (!unexpectedShutdown) {
|
||||
@@ -527,7 +527,7 @@ void audioTask(void * pdata)
|
||||
DEBUG_TIMER_START(debugTimerAudioDuration);
|
||||
audioQueue.wakeup();
|
||||
DEBUG_TIMER_STOP(debugTimerAudioDuration);
|
||||
CoTickDelay(2/*4ms*/);
|
||||
RTOS_WAIT_MS(4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -763,9 +763,9 @@ void AudioQueue::wakeup()
|
||||
|
||||
// mix the normal context (tones and wavs)
|
||||
if (normalContext.isEmpty() && !fragmentsFifo.empty()) {
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
normalContext.setFragment(fragmentsFifo.get());
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
RTOS_UNLOCK_MUTEX(audioMutex);
|
||||
}
|
||||
result = normalContext.mixBuffer(buffer, g_eeGeneral.beepVolume, g_eeGeneral.wavVolume, fade);
|
||||
if (result > 0) {
|
||||
@@ -848,7 +848,7 @@ void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t f
|
||||
return;
|
||||
#endif
|
||||
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
|
||||
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)
|
||||
@@ -899,7 +899,7 @@ void AudioQueue::playFile(const char * filename, uint8_t flags, uint8_t id)
|
||||
return;
|
||||
}
|
||||
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
|
||||
if (flags & PLAY_BACKGROUND) {
|
||||
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));
|
||||
}
|
||||
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
RTOS_UNLOCK_MUTEX(audioMutex);
|
||||
}
|
||||
|
||||
void AudioQueue::stopPlay(uint8_t id)
|
||||
@@ -922,12 +922,12 @@ void AudioQueue::stopPlay(uint8_t id)
|
||||
return;
|
||||
#endif
|
||||
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
|
||||
fragmentsFifo.removePromptById(id);
|
||||
backgroundContext.stop(id);
|
||||
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
RTOS_UNLOCK_MUTEX(audioMutex);
|
||||
}
|
||||
|
||||
void AudioQueue::stopSD()
|
||||
@@ -942,19 +942,19 @@ void AudioQueue::stopSD()
|
||||
void AudioQueue::stopAll()
|
||||
{
|
||||
flush();
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
priorityContext.clear();
|
||||
normalContext.clear();
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
RTOS_UNLOCK_MUTEX(audioMutex);
|
||||
}
|
||||
|
||||
void AudioQueue::flush()
|
||||
{
|
||||
CoEnterMutexSection(audioMutex);
|
||||
RTOS_LOCK_MUTEX(audioMutex);
|
||||
fragmentsFifo.clear();
|
||||
varioContext.clear();
|
||||
backgroundContext.clear();
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
RTOS_UNLOCK_MUTEX(audioMutex);
|
||||
}
|
||||
|
||||
void audioPlay(unsigned int index, uint8_t id)
|
||||
|
||||
@@ -28,7 +28,7 @@ bool warble = false;
|
||||
bool warbleC;
|
||||
|
||||
// The various "beep" tone lengths
|
||||
static const pm_uint8_t beepTab[] PROGMEM = {
|
||||
static const uint8_t beepTab[] = {
|
||||
// key, trim, warn2, warn1, error
|
||||
1, 1, 2, 10, 60, //xShort
|
||||
1, 1, 4, 20, 80, //short
|
||||
@@ -54,7 +54,7 @@ void beep(uint8_t val)
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && val!=0) || (g_eeGeneral.beepMode==-1 && val>=3)) {
|
||||
_beep(pgm_read_byte(beepTab+5*(2+g_eeGeneral.beepLength)+val));
|
||||
_beep(*(beepTab+5*(2+g_eeGeneral.beepLength)+val));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -28,7 +28,7 @@
|
||||
#define CLI_COMMAND_MAX_LEN 256
|
||||
|
||||
OS_TID cliTaskId;
|
||||
TaskStack<CLI_STACK_SIZE> _ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||
TaskStack<CLI_STACK_SIZE> __ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||
Fifo<uint8_t, 256> cliRxFifo;
|
||||
uint8_t cliTracesEnabled = true;
|
||||
char cliLastLine[CLI_COMMAND_MAX_LEN+1];
|
||||
@@ -308,7 +308,7 @@ int cliTestNew()
|
||||
{
|
||||
char * tmp = 0;
|
||||
serialPrint("Allocating 1kB with new()");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
tmp = new char[1024];
|
||||
if (tmp) {
|
||||
serialPrint("\tsuccess");
|
||||
@@ -320,7 +320,7 @@ int cliTestNew()
|
||||
}
|
||||
|
||||
serialPrint("Allocating 10MB with (std::nothrow) new()");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
tmp = new (std::nothrow) char[1024*1024*10];
|
||||
if (tmp) {
|
||||
serialPrint("\tFAILURE, tmp = %p", tmp);
|
||||
@@ -332,7 +332,7 @@ int cliTestNew()
|
||||
}
|
||||
|
||||
serialPrint("Allocating 10MB with new()");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
tmp = new char[1024*1024*10];
|
||||
if (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;
|
||||
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);
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
int cliTestGraphics()
|
||||
{
|
||||
serialPrint("Starting graphics performance test...");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
|
||||
watchdogSuspend(6000/*60s*/);
|
||||
if (pulsesStarted()) {
|
||||
@@ -581,7 +581,7 @@ float runMemoryTest(graphichTestFunc func, const char * name, uint32_t runtime)
|
||||
uint32_t actualRuntime = (uint32_t)CoGetOSTime() - start;
|
||||
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);
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ float runMemoryTest(graphichTestFunc func, const char * name, uint32_t runtime)
|
||||
int cliTestMemorySpeed()
|
||||
{
|
||||
serialPrint("Starting memory speed test...");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
|
||||
watchdogSuspend(6000/*60s*/);
|
||||
if (pulsesStarted()) {
|
||||
@@ -610,7 +610,7 @@ int cliTestMemorySpeed()
|
||||
|
||||
LTDC_Cmd(DISABLE);
|
||||
serialPrint("Disabling LCD...");
|
||||
CoTickDelay(100);
|
||||
RTOS_WAIT_MS(200);
|
||||
|
||||
result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_8bit, 200);
|
||||
result += RUN_GRAPHICS_TEST(testMemoryReadFrom_RAM_32bit, 200);
|
||||
@@ -936,7 +936,7 @@ void printDebugTimers()
|
||||
#endif
|
||||
|
||||
#include "OsMutex.h"
|
||||
extern OS_MutexID audioMutex;
|
||||
extern RTOS_MUTEX_HANDLE audioMutex;
|
||||
|
||||
void printAudioVars()
|
||||
{
|
||||
@@ -1124,7 +1124,7 @@ int cliRepeat(const char ** argv)
|
||||
counter = interval;
|
||||
uint8_t c;
|
||||
while (!cliRxFifo.pop(c) || !(c == '\r' || c == '\n' || c == ' ')) {
|
||||
CoTickDelay(10); // 20ms
|
||||
RTOS_WAIT_MS(20); // 20ms
|
||||
if (++counter >= interval) {
|
||||
cliExecCommand(&argv[2]);
|
||||
counter = 0;
|
||||
@@ -1299,7 +1299,7 @@ void cliTask(void * pdata)
|
||||
uint8_t c;
|
||||
|
||||
while (!cliRxFifo.pop(c)) {
|
||||
CoTickDelay(10); // 20ms
|
||||
RTOS_WAIT_MS(20); // 20ms
|
||||
}
|
||||
|
||||
if (c == 12) {
|
||||
|
||||
@@ -612,8 +612,6 @@ PACK(struct TrainerData {
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define SPLASH_MODE uint8_t splashSpares:3
|
||||
#elif defined(FSPLASH)
|
||||
#define SPLASH_MODE uint8_t splashMode:3
|
||||
#else
|
||||
#define SPLASH_MODE int8_t splashMode:3
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ void dumpTraceBuffer()
|
||||
#if !defined(SIMU)
|
||||
if ((n % 5) == 0) {
|
||||
while (!serial2TxFifo.isEmpty()) {
|
||||
CoTickDelay(1);
|
||||
RTOS_WAIT_TICKS(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+15
-17
@@ -21,27 +21,33 @@
|
||||
#ifndef _DEFINITIONS_H_
|
||||
#define _DEFINITIONS_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(UNUSED)
|
||||
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
|
||||
#endif
|
||||
|
||||
#if defined(SIMU) && __GNUC__
|
||||
#define __ALIGNED __attribute__((aligned(32)))
|
||||
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||
#define __SECTION_USED(s) __attribute__((used))
|
||||
#elif defined(SIMU)
|
||||
#define __ALIGNED
|
||||
#define __ALIGNED(x) __declspec(align(x))
|
||||
#define __SECTION_USED(s)
|
||||
#else
|
||||
#define __ALIGNED __attribute__((aligned(32)))
|
||||
#define __SECTION_USED(s) __attribute__ ((section(s), used))
|
||||
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||
#define __SECTION_USED(s) __attribute__((section(s), used))
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#define __DMA
|
||||
#elif (defined(STM32F4) && !defined(BOOT)) || defined(PCBHORUS)
|
||||
#define __DMA __attribute__((section(".ram"), aligned(32)))
|
||||
#elif (defined(STM32F4) && !defined(BOOT)) || defined(SDRAM)
|
||||
#define __DMA __attribute__((section(".ram"), aligned(4)))
|
||||
#else
|
||||
#define __DMA __ALIGNED
|
||||
#define __DMA __ALIGNED(4)
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS) && !defined(SIMU)
|
||||
#define __SDRAM __attribute__((section(".sdram"), aligned(32)))
|
||||
#if defined(SDRAM) && !defined(SIMU)
|
||||
#define __SDRAM __attribute__((section(".sdram"), aligned(4)))
|
||||
#define __NOINIT __attribute__((section(".noinit")))
|
||||
#else
|
||||
#define __SDRAM __DMA
|
||||
@@ -55,17 +61,9 @@
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#if !defined(FORCEINLINE)
|
||||
#define FORCEINLINE inline
|
||||
#endif
|
||||
#if !defined(NOINLINE)
|
||||
#define NOINLINE
|
||||
#endif
|
||||
#define CONVERT_PTR_UINT(x) ((uint32_t)(uint64_t)(x))
|
||||
#define CONVERT_UINT_PTR(x) ((uint32_t*)(uint64_t)(x))
|
||||
#else
|
||||
#define FORCEINLINE inline __attribute__ ((always_inline))
|
||||
#define NOINLINE __attribute__ ((noinline))
|
||||
#define SIMU_SLEEP(x)
|
||||
#define SIMU_SLEEP_NORET(x)
|
||||
#define CONVERT_PTR_UINT(x) ((uint32_t)(x))
|
||||
|
||||
+12
-12
@@ -38,21 +38,21 @@ void loadFonts();
|
||||
|
||||
#else
|
||||
|
||||
extern const pm_uchar font_5x7[];
|
||||
extern const pm_uchar font_10x14[];
|
||||
extern const unsigned char font_5x7[];
|
||||
extern const unsigned char font_10x14[];
|
||||
|
||||
#if defined(BOLD_FONT) && ((!defined(CPUM64) && !defined(PCBMEGA2560)) || defined(TELEMETRY_NONE)) && !defined(BOOT)
|
||||
#define BOLD_SPECIFIC_FONT
|
||||
extern const pm_uchar font_5x7_B[];
|
||||
#if defined(BOLD_FONT) && !defined(BOOT)
|
||||
#define BOLD_SPECIFIC_FONT
|
||||
extern const unsigned char font_5x7_B[];
|
||||
#endif
|
||||
|
||||
extern const pm_uchar font_3x5[];
|
||||
extern const pm_uchar font_4x6[];
|
||||
extern const pm_uchar font_8x10[];
|
||||
extern const pm_uchar font_22x38_num[];
|
||||
extern const pm_uchar font_5x7_extra[];
|
||||
extern const pm_uchar font_10x14_extra[];
|
||||
extern const pm_uchar font_4x6_extra[];
|
||||
extern const unsigned char font_3x5[];
|
||||
extern const unsigned char font_4x6[];
|
||||
extern const unsigned char font_8x10[];
|
||||
extern const unsigned char font_22x38_num[];
|
||||
extern const unsigned char font_5x7_extra[];
|
||||
extern const unsigned char font_10x14_extra[];
|
||||
extern const unsigned char font_4x6_extra[];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -269,7 +269,6 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MASTER_VOLUME)
|
||||
case FUNC_VOLUME:
|
||||
{
|
||||
getvalue_t raw = getValue(CFN_PARAM(cfn));
|
||||
@@ -280,7 +279,6 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
requiredSpeakerVolume = ((1024 + requiredSpeakerVolumeRawLast) * VOLUME_LEVEL_MAX) / 2048;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
case FUNC_PLAY_SOUND:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar font_5x7[] PROGMEM = {
|
||||
const unsigned char font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_05x07.lbm"
|
||||
@@ -44,13 +44,13 @@ const pm_uchar font_5x7[] PROGMEM = {
|
||||
};
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
const pm_uchar font_5x7_B[] PROGMEM = {
|
||||
const unsigned char font_5x7_B[] = {
|
||||
#include "font_05x07_B_compressed.lbm"
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
const pm_uchar font_10x14[] PROGMEM = {
|
||||
const unsigned char font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_10x14.lbm"
|
||||
@@ -75,10 +75,10 @@ const pm_uchar font_10x14[] PROGMEM = {
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
const pm_uchar font_3x5[] PROGMEM = {
|
||||
const unsigned char font_3x5[] = {
|
||||
#include "font_03x05.lbm"
|
||||
};
|
||||
const pm_uchar font_4x6[] PROGMEM = {
|
||||
const unsigned char font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_04x06.lbm"
|
||||
@@ -101,7 +101,7 @@ const pm_uchar font_4x6[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_8x10[] PROGMEM = {
|
||||
const unsigned char font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_08x10.lbm"
|
||||
@@ -124,19 +124,19 @@ const pm_uchar font_8x10[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_22x38_num[] PROGMEM = {
|
||||
const unsigned char font_22x38_num[] = {
|
||||
#include "font_22x38_num.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_4x6_extra[] PROGMEM = {
|
||||
const unsigned char font_4x6_extra[] = {
|
||||
#include "font_04x06_extra.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_5x7_extra[] PROGMEM = {
|
||||
const unsigned char font_5x7_extra[] = {
|
||||
#include "font_05x07_extra.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_10x14_extra[] PROGMEM = {
|
||||
const unsigned char font_10x14_extra[] = {
|
||||
#include "font_10x14_extra.lbm"
|
||||
};
|
||||
|
||||
|
||||
+11
-11
@@ -160,11 +160,11 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
#define CURSOR_ON_LINE() (0)
|
||||
#endif
|
||||
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow);
|
||||
void check_simple(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(event_t event, uint8_t maxrow);
|
||||
|
||||
void title(const pm_char * s);
|
||||
void title(const char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
@@ -225,8 +225,8 @@ void title(const pm_char * s);
|
||||
|
||||
typedef int choice_t;
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, event_t event);
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char * label, LcdFlags attr, event_t event);
|
||||
int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t event);
|
||||
|
||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
|
||||
@@ -258,17 +258,17 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
|
||||
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr=ZCHAR);
|
||||
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay);
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay);
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
|
||||
#define WARNING_TYPE_ASTERISK 0
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
@@ -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);
|
||||
|
||||
extern const pm_uchar sticks[] PROGMEM;
|
||||
extern const unsigned char sticks[] ;
|
||||
|
||||
void drawSplash();
|
||||
void drawSecondSplash();
|
||||
@@ -376,10 +376,10 @@ void drawSleepBitmap();
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void drawAlertBox(const pm_char * title, const pm_char * text, const char * action);
|
||||
void drawAlertBox(const char * title, const char * text, const char * action);
|
||||
#endif
|
||||
|
||||
void showAlertBox(const pm_char * title, const pm_char * text, const char * action , uint8_t sound);
|
||||
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound);
|
||||
|
||||
#define SET_SCROLLBAR_X(x)
|
||||
#define LOAD_MODEL_BITMAP()
|
||||
|
||||
@@ -67,7 +67,7 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
b[j] = *(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ uint8_t getCharWidth(char c, LcdFlags flags)
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
const pm_uchar * q;
|
||||
const unsigned char * q;
|
||||
|
||||
lcdNextPos = x-1;
|
||||
|
||||
@@ -303,7 +303,7 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags flags)
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags)
|
||||
{
|
||||
const coord_t orig_x = x;
|
||||
|
||||
@@ -331,7 +331,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
c = pgm_read_byte(s);
|
||||
c = *s;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -388,31 +388,31 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len)
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len)
|
||||
{
|
||||
lcdDrawSizedText(x, y, s, len, 0);
|
||||
}
|
||||
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags flags)
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags flags)
|
||||
{
|
||||
lcdDrawSizedText(x, y, s, 255, flags);
|
||||
}
|
||||
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s)
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s)
|
||||
{
|
||||
lcdDrawText(x, y, s, 0);
|
||||
}
|
||||
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s)
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const char * s)
|
||||
{
|
||||
lcdDrawText(0, y, s);
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
uint8_t length;
|
||||
length = pgm_read_byte(s++);
|
||||
length = *(s++);
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
|
||||
}
|
||||
|
||||
|
||||
@@ -108,26 +108,19 @@ extern coord_t lcdNextPos;
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint8_t lcdLock ;
|
||||
extern volatile uint32_t lcdInputs ;
|
||||
#endif
|
||||
|
||||
#if defined(BOOT)
|
||||
// TODO quick & dirty :(
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags);
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags flags);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags flags);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len, LcdFlags flags);
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags flags);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len, LcdFlags flags);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const char * s);
|
||||
|
||||
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
|
||||
|
||||
@@ -137,7 +130,7 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode, uint8_t le
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
|
||||
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val);
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx, LcdFlags att=0);
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att);
|
||||
#if !defined(BOOT) // TODO not here ...
|
||||
void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags att=0);
|
||||
@@ -202,7 +195,7 @@ void drawTelemetryTopBar();
|
||||
|
||||
|
||||
void lcdClear(void);
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const unsigned char * img, uint8_t idx, LcdFlags att=0);
|
||||
inline void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bitmap)
|
||||
{
|
||||
lcdDraw1bitBitmap(x, y, bitmap, 0);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "opentx.h"
|
||||
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay)
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, str);
|
||||
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
|
||||
@@ -39,7 +39,7 @@ uint8_t s_copySrcCh;
|
||||
uint8_t editNameCursorPos = 0;
|
||||
|
||||
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, label);
|
||||
editName(x, y, name, size, event, active);
|
||||
|
||||
@@ -93,7 +93,7 @@ void menuRadioDiagAnalogs(event_t event);
|
||||
void menuRadioHardware(event_t event);
|
||||
void menuRadioCalibration(event_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||
static const MenuHandlerFunc menuTabGeneral[] = {
|
||||
menuRadioSetup,
|
||||
CASE_SDCARD(menuRadioSdManager)
|
||||
menuRadioSpecialFunctions,
|
||||
@@ -144,7 +144,7 @@ void menuModelDisplay(event_t event);
|
||||
void menuModelTemplates(event_t event);
|
||||
void menuModelGVarOne(event_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabModel[] PROGMEM = {
|
||||
static const MenuHandlerFunc menuTabModel[] = {
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
|
||||
@@ -166,9 +166,9 @@ void menuModelCurveOne(event_t event)
|
||||
lcdDrawFilledRect(3, 2*FH+4, 7*FW-2, 4*FH-2, SOLID, ERASE);
|
||||
lcdDrawRect(3, 2*FH+4, 7*FW-2, 4*FH-2);
|
||||
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));
|
||||
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));
|
||||
|
||||
// Selection square
|
||||
|
||||
@@ -123,7 +123,7 @@ void menuModelDisplay(event_t event)
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
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) {
|
||||
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]));
|
||||
|
||||
@@ -67,12 +67,12 @@ void menuModelFlightModeOne(event_t event)
|
||||
#if defined(GVARS) && !defined(GVARS_IN_CURVES_SCREEN)
|
||||
#if defined(PCBTARANIS)
|
||||
#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 uint8_t mstate_tab_fm1[] = {0, 3, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1, 1};
|
||||
#else
|
||||
#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 uint8_t mstate_tab_fm1[] = {0, 0, 0, (uint8_t)-1, 1, 1, 1, 1, 1};
|
||||
#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 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));
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ void menuModelGVarOne(event_t event)
|
||||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(0, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(0, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ void menuModelMixOne(event_t event)
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (attr && editMode>0 && menuHorizontalPosition==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 EXPO_LINE_WEIGHT_POS 7*FW+1
|
||||
|
||||
@@ -266,7 +266,6 @@ void menuModelLimits(event_t event)
|
||||
}
|
||||
|
||||
for (uint8_t j=0; j<ITEM_OUTPUTS_COUNT; j++) {
|
||||
if (attr && (s_editMode>0 || p1valdiff)) STICK_SCROLL_DISABLE();
|
||||
switch (j) {
|
||||
case ITEM_OUTPUTS_OFFSET:
|
||||
#if defined(PPM_UNIT_US)
|
||||
|
||||
@@ -493,7 +493,7 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PCBTARANIS)
|
||||
{
|
||||
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
||||
uint8_t length = pgm_read_byte(STR_VSRCRAW);
|
||||
uint8_t length = STR_VSRCRAW[0];
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
|
||||
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > 5*(NUM_BODY_LINES-i)) {
|
||||
@@ -606,14 +606,14 @@ void menuModelSetup(event_t event)
|
||||
else {
|
||||
if ((states & 0x01) && swactive)
|
||||
attr = INVERS;
|
||||
c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*(i+1)));
|
||||
c = *(STR_VSWITCHES - 2 + 9 + (3*(i+1)));
|
||||
states >>= 1;
|
||||
}
|
||||
if (line && (menuHorizontalPosition == i)) {
|
||||
attr = BLINK | INVERS;
|
||||
}
|
||||
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
|
||||
break;
|
||||
@@ -621,7 +621,7 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_POTS_WARNING:
|
||||
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)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -1269,7 +1269,7 @@ void menuModelSetup(event_t event)
|
||||
|
||||
#if 0
|
||||
case ITEM_MODEL_PPM2_PROTOCOL:
|
||||
lcdDrawTextAlignedLeft(y, PSTR("Port2"));
|
||||
lcdDrawTextAlignedLeft(y, "Port2");
|
||||
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);
|
||||
lcdDrawNumber(lcdLastRightPos, y, g_model.moduleData[1].channelsStart+1, LEFT | (menuHorizontalPosition<=0 ? attr : 0));
|
||||
|
||||
@@ -545,10 +545,10 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_MULTIMODULE &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
|
||||
lcdDrawTextAlignedLeft(y, PSTR("RSNR"));
|
||||
lcdDrawTextAlignedLeft(y, "RSNR");
|
||||
else
|
||||
#endif
|
||||
lcdDrawTextAlignedLeft(y, PSTR("RSSI"));
|
||||
lcdDrawTextAlignedLeft(y, "RSSI");
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_char * warningText = NULL;
|
||||
const pm_char * warningInfoText;
|
||||
const char * warningText = NULL;
|
||||
const char * warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
@@ -39,7 +39,7 @@ void drawMessageBox()
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void showMessageBox(const pm_char * str)
|
||||
void showMessageBox(const char * str)
|
||||
{
|
||||
warningText = str;
|
||||
drawMessageBox();
|
||||
@@ -47,11 +47,11 @@ void showMessageBox(const pm_char * str)
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const pm_uchar ASTERISK_BITMAP[] PROGMEM = {
|
||||
const unsigned char ASTERISK_BITMAP[] = {
|
||||
#include "asterisk.lbm"
|
||||
};
|
||||
|
||||
void drawAlertBox(const pm_char * title, const pm_char * text, const char * action)
|
||||
void drawAlertBox(const char * title, const char * text, const char * action)
|
||||
{
|
||||
lcdClear();
|
||||
lcdDraw1bitBitmap(2, 0, ASTERISK_BITMAP, 0, 0);
|
||||
@@ -77,7 +77,7 @@ void drawAlertBox(const pm_char * title, const pm_char * text, const char * acti
|
||||
#undef MESSAGE_LCD_OFFSET
|
||||
}
|
||||
|
||||
void showAlertBox(const pm_char * title, const pm_char * text, const char * action , uint8_t sound)
|
||||
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound)
|
||||
{
|
||||
drawAlertBox(title, text, action);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define WARNING_LINE_Y 3*FH
|
||||
|
||||
void drawMessageBox();
|
||||
void showMessageBox(const pm_char * title);
|
||||
void showMessageBox(const char * title);
|
||||
void runPopupWarning(event_t event);
|
||||
|
||||
#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL)
|
||||
|
||||
@@ -118,7 +118,6 @@ void menuCommonCalib(event_t event)
|
||||
|
||||
case CALIB_MOVE_STICKS:
|
||||
// MOVE STICKS/POTS
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
|
||||
@@ -33,8 +33,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
|
||||
SIMPLE_MENU(STR_MENU_RADIO_ANALOGS, menuTabGeneral, MENU_RADIO_ANALOGS_TEST, HEADER_LINE+ANAS_ITEMS_COUNT);
|
||||
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
#if (NUM_STICKS+NUM_POTS+NUM_SLIDERS) > 9
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/3)*FH;
|
||||
@@ -45,7 +43,7 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
#else
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
|
||||
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, ':');
|
||||
#endif
|
||||
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));
|
||||
|
||||
@@ -52,7 +52,7 @@ void menuRadioHardware(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS:
|
||||
lcdDrawTextAlignedLeft(y, PSTR("Sticks"));
|
||||
lcdDrawTextAlignedLeft(y, "Sticks");
|
||||
break;
|
||||
|
||||
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_RH_GAIN:
|
||||
{
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, PSTR("\002LVLHRVRH"), k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN, 0);
|
||||
lcdDrawText(INDENT_WIDTH+3*FW, y, PSTR("Gain"));
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, "\002LVLHRVRH", k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN, 0);
|
||||
lcdDrawText(INDENT_WIDTH+3*FW, y, "Gain");
|
||||
uint8_t mask = (1<<(k-ITEM_RADIO_HARDWARE_STICK_LV_GAIN));
|
||||
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
|
||||
lcdDrawChar(HW_SETTINGS_COLUMN, y, val ? '2' : '1', attr);
|
||||
@@ -77,13 +77,13 @@ void menuRadioHardware(event_t event)
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
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) {
|
||||
btInit();
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void menuRadioHardware(event_t event)
|
||||
pauseMixerCalculations();
|
||||
pausePulses();
|
||||
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
|
||||
EXTERNAL_MODULE_ON();
|
||||
resumePulses();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar sticks[] PROGMEM = {
|
||||
const unsigned char sticks[] = {
|
||||
#include "sticks.lbm"
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ const pm_uchar sticks[] PROGMEM = {
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#if defined(SPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
#else
|
||||
#define CASE_SPLASH_PARAM(x)
|
||||
@@ -166,8 +166,8 @@ void menuRadioSetup(event_t event)
|
||||
{
|
||||
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);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
static const uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += dmon[t.tm_mon];
|
||||
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);
|
||||
break;
|
||||
@@ -451,7 +451,7 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#if defined(SPLASH)
|
||||
case ITEM_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
@@ -467,7 +467,7 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
case ITEM_SETUP_TIMEZONE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
@@ -507,12 +507,12 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
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 (g_eeGeneral.fai)
|
||||
POPUP_WARNING(PSTR("FAI\001mode blocked!"));
|
||||
POPUP_WARNING("FAI\001mode blocked!");
|
||||
else
|
||||
POPUP_CONFIRMATION(PSTR("FAI mode?"));
|
||||
POPUP_CONFIRMATION("FAI mode?");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -559,7 +559,7 @@ void menuRadioSetup(event_t event)
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
lcdDrawChar(2*FW, y, '1'+reusableBuffer.generalSettings.stickMode, attr);
|
||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
||||
drawSource((5*FW-3)+i*(4*FW+2), y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
drawSource((5*FW-3)+i*(4*FW+2), y, MIXSRC_Rud + *(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
|
||||
|
||||
@@ -37,11 +37,11 @@ void menuRadioVersion(event_t event)
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
if (Coproc_valid == 1) {
|
||||
lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr:"));
|
||||
lcdDrawTextAlignedLeft(6*FH, "CoPr:");
|
||||
lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAlignedLeft(6*FH, PSTR("CoPr: ---"));
|
||||
lcdDrawTextAlignedLeft(6*FH, "CoPr: ---");
|
||||
}
|
||||
#elif defined(EEPROM_RLC)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
|
||||
|
||||
@@ -20,33 +20,13 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if !defined GET_FAR_ADDRESS
|
||||
#define GET_FAR_ADDRESS(var) \
|
||||
({ \
|
||||
uint32_t tmp; \
|
||||
\
|
||||
__asm__ __volatile__( \
|
||||
\
|
||||
"ldi %A0, lo8(%1)" "\n\t" \
|
||||
"ldi %B0, hi8(%1)" "\n\t" \
|
||||
"ldi %C0, hh8(%1)" "\n\t" \
|
||||
"clr %D0" "\n\t" \
|
||||
: \
|
||||
"=d" (tmp) \
|
||||
: \
|
||||
"p" (&(var)) \
|
||||
); \
|
||||
tmp; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH)
|
||||
const pm_uchar splashdata[] PROGMEM = {
|
||||
const unsigned char splashdata[] = {
|
||||
'S','P','S',0,
|
||||
#include "bitmaps/128x64/splash.lbm"
|
||||
'S','P','E',0 };
|
||||
|
||||
const pm_uchar * const splash_lbm = splashdata+4;
|
||||
const unsigned char * const splash_lbm = splashdata+4;
|
||||
|
||||
void drawSplash()
|
||||
{
|
||||
@@ -65,12 +45,12 @@ void drawSplash()
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH_FRSKY)
|
||||
const pm_uchar splashdata2[] PROGMEM = {
|
||||
const unsigned char splashdata2[] = {
|
||||
'S','F','S',0,
|
||||
#include "bitmaps/128x64/splash_frsky.lbm"
|
||||
'S','F','E',0 };
|
||||
|
||||
const pm_uchar * const splash2_lbm = splashdata2+4;
|
||||
const unsigned char * const splash2_lbm = splashdata2+4;
|
||||
|
||||
void drawSecondSplash()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar about_bmp[] PROGMEM = {
|
||||
const unsigned char about_bmp[] = {
|
||||
#include "about.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ void displayTrims(uint8_t phase)
|
||||
}
|
||||
}
|
||||
|
||||
FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
||||
void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
||||
{
|
||||
const TimerData & timer = g_model.timers[index];
|
||||
if (timer.mode) {
|
||||
@@ -303,8 +303,6 @@ void onMainViewMenu(const char *result)
|
||||
|
||||
void menuMainView(event_t event)
|
||||
{
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
uint8_t view = g_eeGeneral.view;
|
||||
uint8_t view_base = view & 0x0f;
|
||||
|
||||
@@ -564,12 +562,12 @@ void menuMainView(event_t event)
|
||||
warningText = STR_GLOBAL_VAR;
|
||||
drawMessageBox();
|
||||
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);
|
||||
if (g_model.gvars[gvarLastChanged].unit) {
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD);
|
||||
}
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, PSTR("]"), BOLD);
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, "]", BOLD);
|
||||
warningText = NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -577,7 +575,7 @@ void menuMainView(event_t event)
|
||||
#if defined(DSM2)
|
||||
if (moduleFlag[0] == MODULE_BIND) {
|
||||
// Issue 98
|
||||
lcdDrawText(15*FW, 0, PSTR("BIND"), 0);
|
||||
lcdDrawText(15*FW, 0, "BIND", 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -187,13 +187,13 @@ void menuStatisticsDebug(event_t event)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP);
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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 {
|
||||
drawValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT);
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
#define STATUS_BAR_Y (7*FH+1)
|
||||
#define TELEM_2ND_COLUMN (10*FW)
|
||||
|
||||
#if defined(FRSKY_HUB) && defined(GAUGES)
|
||||
bar_threshold_t barsThresholds[THLD_MAX];
|
||||
#endif
|
||||
|
||||
uint8_t s_frsky_view = 0;
|
||||
|
||||
#define BAR_LEFT 25
|
||||
@@ -168,11 +164,9 @@ bool displayCustomTelemetryScreen(uint8_t index)
|
||||
{
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[index];
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(s_frsky_view)) {
|
||||
return displayGaugesTelemetryScreen(screen);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayNumbersTelemetryScreen(screen);
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
|
||||
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
|
||||
void title(const pm_char * s)
|
||||
void title(const char * s)
|
||||
{
|
||||
lcdDrawText(0, 0, s, INVERS);
|
||||
}
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
|
||||
{
|
||||
drawFieldLabel(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
@@ -78,7 +78,7 @@ choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *
|
||||
return value;
|
||||
}
|
||||
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event )
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event )
|
||||
{
|
||||
#if defined(GRAPHICS)
|
||||
drawCheckBox(x, y, value, attr);
|
||||
@@ -246,7 +246,7 @@ void drawProgressBar(const char * label, int num, int den)
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const pm_uchar SLEEP_BITMAP[] PROGMEM = {
|
||||
const unsigned char SLEEP_BITMAP[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar font_5x7[] PROGMEM = {
|
||||
const unsigned char font_5x7[] = {
|
||||
#include "font_05x07.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_05x07.lbm"
|
||||
@@ -43,12 +43,12 @@ const pm_uchar font_5x7[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_5x7_B[] PROGMEM = {
|
||||
const unsigned char font_5x7_B[] = {
|
||||
#include "font_05x07_B_compressed.lbm"
|
||||
};
|
||||
|
||||
#if !defined(BOOT)
|
||||
const pm_uchar font_10x14[] PROGMEM = {
|
||||
const unsigned char font_10x14[] = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_10x14.lbm"
|
||||
@@ -71,11 +71,11 @@ const pm_uchar font_10x14[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_3x5[] PROGMEM = {
|
||||
const unsigned char font_3x5[] = {
|
||||
#include "font_03x05.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_4x6[] PROGMEM = {
|
||||
const unsigned char font_4x6[] = {
|
||||
#include "font_04x06.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_04x06.lbm"
|
||||
@@ -98,7 +98,7 @@ const pm_uchar font_4x6[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_8x10[] PROGMEM = {
|
||||
const unsigned char font_8x10[] = {
|
||||
#include "font_08x10.lbm"
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_08x10.lbm"
|
||||
@@ -121,19 +121,19 @@ const pm_uchar font_8x10[] PROGMEM = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const pm_uchar font_22x38_num[] PROGMEM = {
|
||||
const unsigned char font_22x38_num[] = {
|
||||
#include "font_22x38_num.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_4x6_extra[] PROGMEM = {
|
||||
const unsigned char font_4x6_extra[] = {
|
||||
#include "font_04x06_extra.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_5x7_extra[] PROGMEM = {
|
||||
const unsigned char font_5x7_extra[] = {
|
||||
#include "font_05x07_extra.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar font_10x14_extra[] PROGMEM = {
|
||||
const unsigned char font_10x14_extra[] = {
|
||||
#include "font_10x14_extra.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -178,11 +178,11 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
|
||||
|
||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||
void check(const char * title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check(const char * title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check_simple(const char *title, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(const char * title, event_t event, uint8_t maxrow);
|
||||
|
||||
void title(const pm_char * s);
|
||||
void title(const char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
@@ -224,8 +224,8 @@ void title(const pm_char * s);
|
||||
|
||||
typedef int choice_t;
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char *label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event);
|
||||
choice_t editChoice(coord_t x, coord_t y, const char *label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event);
|
||||
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
|
||||
|
||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
|
||||
@@ -249,7 +249,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
||||
|
||||
extern uint8_t editNameCursorPos;
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr=ZCHAR);
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay);
|
||||
#define EDIT_DELAY(y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
@@ -260,8 +260,8 @@ uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint
|
||||
|
||||
void copySelection(char * dst, const char * src, uint8_t size);
|
||||
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
@@ -326,7 +326,7 @@ uint8_t switchToMix(uint8_t source);
|
||||
extern coord_t scrollbar_X;
|
||||
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);
|
||||
|
||||
extern const pm_uchar sticks[] PROGMEM;
|
||||
extern const unsigned char sticks[] ;
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
|
||||
|
||||
@@ -103,7 +103,7 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
b[j] = *(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
@@ -342,30 +342,30 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len)
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len)
|
||||
{
|
||||
lcdDrawSizedText(x, y, s, len, 0);
|
||||
}
|
||||
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags flags)
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags flags)
|
||||
{
|
||||
lcdDrawSizedText(x, y, s, 255, flags);
|
||||
}
|
||||
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s)
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s)
|
||||
{
|
||||
lcdDrawText(x, y, s, 0);
|
||||
}
|
||||
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s)
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const char * s)
|
||||
{
|
||||
lcdDrawText(0, y, s);
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
uint8_t length = pgm_read_byte(s++);
|
||||
uint8_t length = *(s++);
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
|
||||
}
|
||||
|
||||
@@ -914,16 +914,16 @@ void lcdInvertLine(int8_t line)
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const unsigned char * img, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
const pm_uchar *q = img;
|
||||
uint8_t w = pgm_read_byte(q++);
|
||||
uint8_t hb = (pgm_read_byte(q++)+7) / 8;
|
||||
const unsigned char *q = img;
|
||||
uint8_t w = *(q++);
|
||||
uint8_t hb = (*(q++)+7) / 8;
|
||||
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
|
||||
q += idx*w*hb;
|
||||
for (uint8_t yb = 0; yb < hb; yb++) {
|
||||
for (uint8_t i=0; i<w; i++) {
|
||||
uint8_t b = pgm_read_byte(q++);
|
||||
uint8_t b = *(q++);
|
||||
uint8_t val = inv ? ~b : b;
|
||||
for (int k=0; k<8; k++) {
|
||||
if (val & (1<<k)) {
|
||||
|
||||
@@ -104,20 +104,14 @@ extern coord_t lcdNextPos;
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
#if defined(BOOT)
|
||||
// TODO quick & dirty :(
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags mode);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags mode);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags mode);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s,unsigned char len, LcdFlags mode);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const char * s);
|
||||
|
||||
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
|
||||
|
||||
@@ -125,7 +119,7 @@ void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode=0);
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char *str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||
void drawSwitch(coord_t x, coord_t y, int32_t swtch, LcdFlags att=0);
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
@@ -182,7 +176,7 @@ void drawTelemetryTopBar();
|
||||
lcdDrawSolidVerticalLine(xx ,yy-ll,ll); \
|
||||
lcdDrawSolidVerticalLine(xx+1,yy-ll,ll)
|
||||
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const unsigned char * img, uint8_t idx, LcdFlags att=0);
|
||||
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0);
|
||||
#define LCD_ICON(x, y, icon) lcdDrawBitmap(x, y, icons, icon)
|
||||
|
||||
@@ -60,7 +60,7 @@ uint8_t s_copySrcCh;
|
||||
|
||||
uint8_t editNameCursorPos = 0;
|
||||
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char *name, uint8_t size, event_t event, uint8_t active)
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char *name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, label);
|
||||
editName(x, y, name, size, event, active);
|
||||
|
||||
@@ -125,7 +125,7 @@ void menuModelDisplay(event_t event)
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
|
||||
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
|
||||
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) {
|
||||
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]));
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
|
||||
{
|
||||
lcdDrawText(x, y, STR_FP);
|
||||
lcdDrawText(x, y, STR_FM);
|
||||
x = lcdNextPos + 1;
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
lcdDrawChar(x, y, ((value & (1<<p)) ? '-' : '0'+p));
|
||||
|
||||
@@ -107,7 +107,7 @@ void menuModelGVarOne(event_t event)
|
||||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(0, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(0, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void menuModelGVars(event_t event)
|
||||
if (after2seconds) {
|
||||
menuTitle = STR_GVARS;
|
||||
for (int i=0; i<MAX_GVARS; i++) {
|
||||
drawStringWithIndex(GVARS_FM_COLUMN(i), 1, STR_FP, i, SMLSIZE|(getFlightMode()==i ? INVERS : 0));
|
||||
drawStringWithIndex(GVARS_FM_COLUMN(i), 1, STR_FM, i, SMLSIZE|(getFlightMode()==i ? INVERS : 0));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -148,7 +148,6 @@ void menuModelLimits(event_t event)
|
||||
for (int j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
LcdFlags attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && s_editMode>0) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
{
|
||||
case ITEM_LIMITS_CH_NAME:
|
||||
|
||||
@@ -574,7 +574,7 @@ void menuModelSetup(event_t event)
|
||||
#endif
|
||||
|
||||
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)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -519,10 +519,10 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
|
||||
lcdDrawTextAlignedLeft(y, PSTR("RSNR"));
|
||||
lcdDrawTextAlignedLeft(y, "RSNR");
|
||||
else
|
||||
#endif
|
||||
lcdDrawTextAlignedLeft(y, PSTR("RSSI"));
|
||||
lcdDrawTextAlignedLeft(y, "RSSI");
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
|
||||
@@ -44,7 +44,7 @@ void showMessageBox(const char * title)
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const pm_uchar ASTERISK_BITMAP[] PROGMEM = {
|
||||
const unsigned char ASTERISK_BITMAP[] = {
|
||||
#include "asterisk.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -126,7 +126,6 @@ void menuCommonCalib(event_t event)
|
||||
|
||||
case CALIB_MOVE_STICKS:
|
||||
// MOVE STICKS/POTS
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
|
||||
@@ -24,8 +24,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENU_RADIO_ANALOGS, menuTabGeneral, MENU_RADIO_ANALOGS_TEST, 0);
|
||||
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
|
||||
uint8_t x = i&1 ? LCD_W/2 + FW : 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar sticks[] PROGMEM = {
|
||||
const unsigned char sticks[] = {
|
||||
#include "sticks.lbm"
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ const pm_uchar sticks[] PROGMEM = {
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#if defined(SPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
#else
|
||||
#define CASE_SPLASH_PARAM(x)
|
||||
@@ -149,8 +149,8 @@ void menuRadioSetup(event_t event)
|
||||
{
|
||||
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);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
static const uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += dmon[t.tm_mon];
|
||||
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);
|
||||
break;
|
||||
@@ -395,7 +395,7 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#if defined(SPLASH)
|
||||
case ITEM_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
@@ -411,7 +411,7 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
case ITEM_SETUP_LABEL_GPS:
|
||||
lcdDrawTextAlignedLeft(y, STR_GPS);
|
||||
break;
|
||||
@@ -455,12 +455,12 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
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 (g_eeGeneral.fai)
|
||||
POPUP_WARNING(PSTR("FAI\001mode blocked!"));
|
||||
POPUP_WARNING("FAI\001mode blocked!");
|
||||
else
|
||||
POPUP_CONFIRMATION(PSTR("FAI mode?"));
|
||||
POPUP_CONFIRMATION("FAI mode?");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -495,7 +495,7 @@ void menuRadioSetup(event_t event)
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
lcdDrawChar(2*FW, y, '1'+reusableBuffer.generalSettings.stickMode, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
putsStickName((6+4*i)*FW, y, pgm_read_byte(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
putsStickName((6+4*i)*FW, y, *(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i), 0);
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(SPLASH)
|
||||
const pm_uchar splashdata[] PROGMEM = {
|
||||
const unsigned char splashdata[] = {
|
||||
'S','P','S',0,
|
||||
#include "bitmaps/212x64/splash.lbm"
|
||||
'S','P','E',0 };
|
||||
const pm_uchar * const splash_lbm = splashdata+4;
|
||||
const unsigned char * const splash_lbm = splashdata+4;
|
||||
|
||||
void drawSplash()
|
||||
{
|
||||
@@ -44,11 +44,11 @@ void drawSplash()
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH_FRSKY)
|
||||
const pm_uchar splashdata2[] PROGMEM = {
|
||||
const unsigned char splashdata2[] = {
|
||||
'S','F','S',0,
|
||||
#include "bitmaps/212x64/splash_frsky.lbm"
|
||||
'S','F','E',0 };
|
||||
const pm_uchar * const splash2_lbm = splashdata2+4;
|
||||
const unsigned char * const splash2_lbm = splashdata2+4;
|
||||
|
||||
void drawSecondSplash()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar about_bmp[] PROGMEM = {
|
||||
const unsigned char about_bmp[] = {
|
||||
#include "about.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -49,11 +49,11 @@
|
||||
#define TRIM_LEN 27
|
||||
#define MARKER_WIDTH 5
|
||||
|
||||
const pm_uchar logo_taranis[] PROGMEM = {
|
||||
const unsigned char logo_taranis[] = {
|
||||
#include "logo.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar icons[] PROGMEM = {
|
||||
const unsigned char icons[] = {
|
||||
#include "icons.lbm"
|
||||
};
|
||||
|
||||
@@ -439,8 +439,6 @@ void menuMainView(event_t event)
|
||||
{
|
||||
static bool secondPage = false;
|
||||
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
switch(event) {
|
||||
|
||||
case EVT_ENTRY:
|
||||
@@ -594,9 +592,9 @@ void menuMainView(event_t event)
|
||||
lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32);
|
||||
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);
|
||||
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);
|
||||
lcdDrawText(lcdLastRightPos, BITMAP_Y+2*FH+3, PSTR("]"), BOLD);
|
||||
lcdDrawText(lcdLastRightPos, BITMAP_Y+2*FH+3, "]", BOLD);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar SLEEP_BITMAP[] PROGMEM = {
|
||||
const unsigned char SLEEP_BITMAP[] = {
|
||||
#include "../../bitmaps/212x64/sleep.lbm"
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ void drawSleepBitmap()
|
||||
}
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
const pm_uchar SHUTDOWN_BITMAP[] PROGMEM = {
|
||||
const unsigned char SHUTDOWN_BITMAP[] = {
|
||||
#include "../../bitmaps/212x64/shutdown.lbm"
|
||||
};
|
||||
|
||||
@@ -125,12 +125,12 @@ void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t
|
||||
}
|
||||
}
|
||||
|
||||
void title(const pm_char * s)
|
||||
void title(const char * s)
|
||||
{
|
||||
lcdDrawText(0, 0, s, INVERS);
|
||||
}
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
|
||||
{
|
||||
drawFieldLabel(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
@@ -138,7 +138,7 @@ choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *
|
||||
return value;
|
||||
}
|
||||
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, event_t event )
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event )
|
||||
{
|
||||
drawCheckBox(x, y, value, attr);
|
||||
return editChoice(x, y, label, NULL, value, 0, 1, attr, event);
|
||||
|
||||
@@ -318,7 +318,7 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
|
||||
int width = getTextWidth(s, len, flags);
|
||||
int height = getFontHeight(flags);
|
||||
uint32_t fontindex = FONTINDEX(flags);
|
||||
const pm_uchar * font = fontsTable[fontindex];
|
||||
const unsigned char * font = fontsTable[fontindex];
|
||||
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
||||
BitmapBuffer * fontcache = NULL;
|
||||
|
||||
@@ -541,23 +541,23 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
|
||||
FRESULT result = f_open(&imgFile, filename, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result != FR_OK) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (f_size(&imgFile) < 14) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
result = f_read(&imgFile, buf, 14, &read);
|
||||
if (result != FR_OK || read != 14) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (buf[0] != 'B' || buf[1] != 'M') {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t fsize = *((uint32_t *)&buf[2]);
|
||||
@@ -567,7 +567,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
result = f_read(&imgFile, buf, len, &read);
|
||||
if (result != FR_OK || read != len) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t ihsize = *((uint32_t *)&buf[0]); /* more header size */
|
||||
@@ -575,7 +575,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
/* invalid header size */
|
||||
if (ihsize + 14 > hsize) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* sometimes file size is set to some headers size, set a real size in that case */
|
||||
@@ -585,7 +585,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
/* declared file size less than header size */
|
||||
if (fsize <= hsize) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t w, h;
|
||||
@@ -607,12 +607,12 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
break;
|
||||
default:
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (*((uint16_t *)&buf[0]) != 1) { /* planes */
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint16_t depth = *((uint16_t *)&buf[2]);
|
||||
@@ -622,7 +622,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
if (depth == 4) {
|
||||
if (f_lseek(&imgFile, hsize-64) != FR_OK || f_read(&imgFile, buf, 64, &read) != FR_OK || read != 64) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
palette[i] = buf[4*i];
|
||||
@@ -631,14 +631,14 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
else {
|
||||
if (f_lseek(&imgFile, hsize) != FR_OK) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
BitmapBuffer * bmp = new BitmapBuffer(BMP_RGB565, w, h);
|
||||
if (bmp == NULL || bmp->getData() == NULL) {
|
||||
if (bmp == nullptr || bmp->getData() == nullptr) {
|
||||
f_close(&imgFile);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t rowSize;
|
||||
@@ -654,7 +654,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
if (result != FR_OK || read != 4) {
|
||||
f_close(&imgFile);
|
||||
delete bmp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (hasAlpha) {
|
||||
*dst = ARGB(pixel & 0xff, (pixel >> 24) & 0xff, (pixel >> 16) & 0xff, (pixel >> 8) & 0xff);
|
||||
@@ -688,7 +688,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
if (result != FR_OK || read != rowSize) {
|
||||
f_close(&imgFile);
|
||||
delete bmp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
display_t * dst = bmp->getPixelPtr(0, i);
|
||||
for (uint32_t j=0; j<w; j++) {
|
||||
@@ -703,7 +703,7 @@ BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)
|
||||
default:
|
||||
f_close(&imgFile);
|
||||
delete bmp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
f_close(&imgFile);
|
||||
@@ -787,7 +787,7 @@ BitmapBuffer * BitmapBuffer::load_stb(const char * filename)
|
||||
{
|
||||
FRESULT result = f_open(&imgFile, filename, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result != FR_OK) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int w, h, n;
|
||||
@@ -795,7 +795,7 @@ BitmapBuffer * BitmapBuffer::load_stb(const char * filename)
|
||||
f_close(&imgFile);
|
||||
|
||||
if (!img) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// convert to RGB565 or ARGB4444 format
|
||||
@@ -803,7 +803,7 @@ BitmapBuffer * BitmapBuffer::load_stb(const char * filename)
|
||||
if (bmp == NULL) {
|
||||
TRACE("load_stb() malloc failed");
|
||||
stbi_image_free(img);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -61,7 +61,7 @@ class BitmapBufferBase
|
||||
}
|
||||
|
||||
BitmapBufferBase(uint8_t format, T * data):
|
||||
BitmapBufferBase(format, *((uint16_t*)data), *(((uint16_t*)data)+1), data + 2)
|
||||
BitmapBufferBase(format, data[0], data[1], data + 2)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -140,23 +140,23 @@ const uint8_t LBM_SHUTDOWN_CIRCLE[] = {
|
||||
#include "mask_shutdown_circle.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED = {
|
||||
const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED(4) = {
|
||||
#include "bar_left.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED = {
|
||||
const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED(4) = {
|
||||
#include "bar_right.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED = {
|
||||
const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED(4) = {
|
||||
#include "point_out.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED = {
|
||||
const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED(4) = {
|
||||
#include "point_mid.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED = {
|
||||
const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED(4) = {
|
||||
#include "point_in.lbm"
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const uint16_t font_tinsize_specs[] = {
|
||||
#include "font_tinsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_tinsize[] = {
|
||||
const unsigned char font_tinsize[] = {
|
||||
#include "font_tinsize.lbm"
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ const uint16_t font_smlsize_specs[] = {
|
||||
#include "font_smlsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_smlsize[] = {
|
||||
const unsigned char font_smlsize[] = {
|
||||
#include "font_smlsize.lbm"
|
||||
};
|
||||
#endif
|
||||
@@ -43,7 +43,7 @@ const uint16_t font_stdsize_specs[] = {
|
||||
#include "font_stdsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_stdsize[] = {
|
||||
const unsigned char font_stdsize[] = {
|
||||
#include "font_stdsize.lbm"
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ const uint16_t font_midsize_specs[] = {
|
||||
#include "font_midsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_midsize[] = {
|
||||
const unsigned char font_midsize[] = {
|
||||
#include "font_midsize.lbm"
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ const uint16_t font_dblsize_specs[] = {
|
||||
#include "font_dblsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_dblsize[] = {
|
||||
const unsigned char font_dblsize[] = {
|
||||
#include "font_dblsize.lbm"
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ const uint16_t font_xxlsize_specs[] = {
|
||||
#include "font_xxlsize.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_xxlsize[] = {
|
||||
const unsigned char font_xxlsize[] = {
|
||||
#include "font_xxlsize.lbm"
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ const uint16_t font_stdsizebold_specs[] = {
|
||||
#include "font_stdsizebold.specs"
|
||||
};
|
||||
|
||||
const pm_uchar font_stdsizebold[] = {
|
||||
const unsigned char font_stdsizebold[] = {
|
||||
#include "font_stdsizebold.lbm"
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,7 @@ void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
|
||||
{
|
||||
uint32_t fontindex = FONTINDEX(flags);
|
||||
const pm_uchar * font = fontsTable[fontindex];
|
||||
const unsigned char * font = fontsTable[fontindex];
|
||||
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
||||
lcdPutFontPattern(x, y, font, fontspecs, getMappedChar(c), flags);
|
||||
}
|
||||
@@ -142,10 +142,10 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
||||
return result;
|
||||
}
|
||||
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags flags)
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
uint8_t length;
|
||||
length = pgm_read_byte(s++);
|
||||
length = *(s++);
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~ZCHAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ extern coord_t lcdNextPos;
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags=0);
|
||||
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags flags=0);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags=0);
|
||||
|
||||
inline void lcdClear()
|
||||
{
|
||||
@@ -132,7 +132,7 @@ inline void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags attr=0)
|
||||
lcd->drawText(x, y, s, attr);
|
||||
}
|
||||
|
||||
inline void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=0)
|
||||
inline void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags attr=0)
|
||||
{
|
||||
lcd->drawSizedText(x, y, s, len, attr);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ bool menuStatsDebug(event_t event);
|
||||
bool menuStatsAnalogs(event_t event);
|
||||
bool menuStatsTraces(event_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabStats[] PROGMEM = {
|
||||
static const MenuHandlerFunc menuTabStats[] = {
|
||||
menuStatsGraph,
|
||||
menuStatsDebug,
|
||||
menuStatsAnalogs,
|
||||
@@ -243,7 +243,7 @@ extern uint8_t lastMonitorPage;
|
||||
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 const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM;
|
||||
extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] ;
|
||||
|
||||
bool menuFirstCalib(event_t event);
|
||||
bool menuMainView(event_t event);
|
||||
@@ -428,8 +428,8 @@ extern uint8_t s_curveChan;
|
||||
#define WARNING_TYPE_INPUT 3
|
||||
#define WARNING_TYPE_INFO 4
|
||||
|
||||
extern const pm_char * warningText;
|
||||
extern const pm_char * warningInfoText;
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
|
||||
@@ -101,7 +101,7 @@ bool menuModelGVarOne(event_t event)
|
||||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(MIXES_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ bool menuModelExpoOne(event_t event)
|
||||
return true;
|
||||
}
|
||||
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#define EXPO_LINE_WEIGHT_POS 125
|
||||
|
||||
@@ -280,7 +280,7 @@ bool menuModelMixOne(event_t event)
|
||||
return true;
|
||||
}
|
||||
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#define MIX_LINE_WEIGHT_POS 105
|
||||
|
||||
@@ -139,7 +139,6 @@ bool menuModelLimits(event_t event)
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && s_editMode>0) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
{
|
||||
case ITEM_LIMITS_CH_NAME:
|
||||
|
||||
@@ -530,7 +530,7 @@ bool menuModelSetup(event_t event)
|
||||
|
||||
case ITEM_MODEL_SLIDPOT_WARNING_STATE:
|
||||
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) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -526,10 +526,10 @@ bool menuModelTelemetryFrsky(event_t event)
|
||||
if (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
|
||||
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
|
||||
#endif
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, PSTR("RSSI"));
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "RSSI");
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
|
||||
@@ -179,7 +179,7 @@ bool menuRadioHardware(event_t event)
|
||||
pauseMixerCalculations();
|
||||
pausePulses();
|
||||
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
|
||||
EXTERNAL_MODULE_ON();
|
||||
resumePulses();
|
||||
|
||||
@@ -67,7 +67,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
|
||||
void getSelectionFullPath(char * lfn)
|
||||
{
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - menuVerticalOffset]);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void onSdManagerMenu(const char * result)
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
// if destination is dir, copy into that dir
|
||||
if (IS_DIRECTORY(line)) {
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
}
|
||||
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
|
||||
|
||||
@@ -154,8 +154,8 @@ bool menuRadioSetup(event_t event)
|
||||
{
|
||||
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);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
static const uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += dmon[t.tm_mon];
|
||||
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);
|
||||
break;
|
||||
@@ -427,15 +427,15 @@ bool menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
case ITEM_SETUP_FAI:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, PSTR("FAI Mode"));
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "FAI Mode");
|
||||
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 {
|
||||
g_eeGeneral.fai = editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
g_eeGeneral.fai = false;
|
||||
POPUP_CONFIRMATION(PSTR("FAI mode?"));
|
||||
POPUP_CONFIRMATION("FAI mode?");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -473,7 +473,7 @@ bool menuRadioSetup(event_t event)
|
||||
s[0] = '1'+reusableBuffer.generalSettings.stickMode;
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, s, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
drawSource(RADIO_SETUP_2ND_COLUMN + 40 + 50*i, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i));
|
||||
drawSource(RADIO_SETUP_2ND_COLUMN + 40 + 50*i, y, MIXSRC_Rud + *(modn12x3 + 4*reusableBuffer.generalSettings.stickMode + i));
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_GENVAR(event, reusableBuffer.generalSettings.stickMode, 0, 3);
|
||||
|
||||
@@ -22,45 +22,39 @@
|
||||
|
||||
#if defined(SPLASH)
|
||||
|
||||
const uint8_t __bmp_splash[] {
|
||||
const uint8_t __bmp_splash[] __ALIGNED(4) {
|
||||
#include "bmp_splash.lbm"
|
||||
};
|
||||
Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t*)__bmp_splash);
|
||||
Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t *)__bmp_splash);
|
||||
|
||||
void drawSplash()
|
||||
{
|
||||
static bool loadImgFromSD = true;
|
||||
static BitmapBuffer* splashImg = NULL;
|
||||
static bool loadImgFromSD = true;
|
||||
static BitmapBuffer * splashImg = nullptr;
|
||||
|
||||
if (loadImgFromSD && splashImg == NULL) {
|
||||
bool sd_mounted = sdMounted();
|
||||
if (!sd_mounted) sdInit();
|
||||
splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE);
|
||||
loadImgFromSD = false;
|
||||
if (!sd_mounted) sdDone();
|
||||
}
|
||||
|
||||
lcd->clear();
|
||||
|
||||
if (splashImg) {
|
||||
lcd->drawBitmap((LCD_W - splashImg->getWidth())/2,
|
||||
(LCD_H - splashImg->getHeight())/2,
|
||||
splashImg);
|
||||
}
|
||||
else {
|
||||
// TODO: verify / load / decompress bitmap
|
||||
lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2,
|
||||
(LCD_H - BMP_SPLASH.getHeight())/2,
|
||||
&BMP_SPLASH);
|
||||
}
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
if (readonly == false) {
|
||||
lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID|ROUND);
|
||||
lcdDrawText((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED);
|
||||
if (loadImgFromSD && splashImg == nullptr) {
|
||||
bool sd_mounted = sdMounted();
|
||||
if (!sd_mounted)
|
||||
sdInit();
|
||||
splashImg = BitmapBuffer::load(BITMAPS_PATH "/" SPLASH_FILE);
|
||||
loadImgFromSD = false;
|
||||
if (!sd_mounted)
|
||||
sdDone();
|
||||
}
|
||||
#endif
|
||||
|
||||
lcd->clear();
|
||||
|
||||
if (splashImg) {
|
||||
lcd->drawBitmap((LCD_W - splashImg->getWidth())/2,
|
||||
(LCD_H - splashImg->getHeight())/2,
|
||||
splashImg);
|
||||
}
|
||||
else {
|
||||
lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2,
|
||||
(LCD_H - BMP_SPLASH.getHeight())/2,
|
||||
&BMP_SPLASH);
|
||||
}
|
||||
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ bool menuChannelsMonitor(event_t event)
|
||||
return menuChannelsMonitor(event, index);
|
||||
}
|
||||
|
||||
const MenuHandlerFunc menuTabMonitors[] PROGMEM = {
|
||||
const MenuHandlerFunc menuTabMonitors[] = {
|
||||
menuChannelsMonitor<0>,
|
||||
menuChannelsMonitor<1>,
|
||||
menuChannelsMonitor<2>,
|
||||
@@ -162,7 +162,7 @@ void drawComboOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t chan
|
||||
lcdDrawNumber(x + limPos, y + h, chanVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%");
|
||||
}
|
||||
|
||||
coord_t drawChannelsMonitorLegend(coord_t x, const pm_char * s, int color)
|
||||
coord_t drawChannelsMonitorLegend(coord_t x, const char * s, int color)
|
||||
{
|
||||
lcdDrawSolidFilledRect(x, MENU_FOOTER_TOP + 2, LEG_COLORBOX + 2, LEG_COLORBOX + 2, BARGRAPH_BGCOLOR);
|
||||
lcdDrawSolidFilledRect(x + 1, MENU_FOOTER_TOP + 3, LEG_COLORBOX, LEG_COLORBOX, color);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
uint8_t getExposCount()
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
uint8_t getMixesCount()
|
||||
|
||||
@@ -64,7 +64,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
|
||||
void getSelectionFullPath(char * lfn)
|
||||
{
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[menuVerticalPosition - HEADER_LINE - menuVerticalOffset]);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void onSdManagerMenu(const char * result)
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
// if destination is dir, copy into that dir
|
||||
if (IS_DIRECTORY(line)) {
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
}
|
||||
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
|
||||
@@ -114,7 +114,7 @@ void onSdManagerMenu(const char * result)
|
||||
getSelectionFullPath(lfn);
|
||||
f_unlink(lfn);
|
||||
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();
|
||||
REFRESH_FILES();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx, LcdFlags flags)
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags flags)
|
||||
{
|
||||
if (flags & RIGHT) {
|
||||
lcdDrawNumber(x, y, idx, flags);
|
||||
|
||||
@@ -43,6 +43,6 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
drawStringWithIndex(x, y, STR_FP, idx-1, att);
|
||||
drawStringWithIndex(x, y, STR_FM, idx-1, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ struct mm_protocol_definition {
|
||||
uint8_t protocol;
|
||||
uint8_t maxSubtype;
|
||||
bool failsafe;
|
||||
const pm_char *subTypeString;
|
||||
const char *subTypeString;
|
||||
const char *optionsstr;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
// local strings
|
||||
|
||||
const pm_char STR_SUBTYPE_FLYSKY[] PROGMEM = "\004""Std\0""V9x9""V6x6""V912""CX20";
|
||||
const 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 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 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 char STR_SUBTYPE_HISKY[] = "\005""HiSky""HK310";
|
||||
|
||||
const pm_char STR_SUBTYPE_DSM[] PROGMEM = "\006""2 22ms""2 11ms""X 22ms""X 11ms";
|
||||
const 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 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 char STR_SUBTYPE_SYMAX[] = "\003""Std""5c\0";
|
||||
|
||||
const pm_char STR_SUBTYPE_SLT[] PROGMEM = "\005""SLT\0 ""Vista";
|
||||
const 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 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 char STR_SUBTYPE_CG023[] = "\005""CG023""YD829";
|
||||
|
||||
const pm_char STR_SUBTYPE_KN[] PROGMEM = "\006""WLtoys""FeiLun";
|
||||
const 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 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 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 char STR_SUBTYPE_HONTAI[] = "\007""Std\0 ""JJRC X1""X5C1cln";
|
||||
|
||||
const pm_char STR_SUBTYPE_Q2X2[] PROGMEM = "\004""Q222""Q242""Q282";
|
||||
const char STR_SUBTYPE_Q2X2[] = "\004""Q222""Q242""Q282";
|
||||
|
||||
const pm_char STR_SUBTYPE_Q303[] PROGMEM = "\006""Q303\0 ""CX35\0 ""CX10D\0""CX10WD";
|
||||
const 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 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 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 char STR_SUBTYPE_BAYANG[] = "\007""Bayang\0""H8S3D\0 ""X16 AH\0 ""irdrone";
|
||||
|
||||
const pm_char STR_SUBTYPE_FY326[] PROGMEM = "\005""FY326""FY319";
|
||||
const 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 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 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 char STR_SUBTYPE_CORONA[] = "\005""V1\0 ""V2\0 ""FD V3";
|
||||
|
||||
const pm_char STR_SUBTYPE_HITEC[] PROGMEM = "\006""Optima\0""Minima";
|
||||
const char STR_SUBTYPE_HITEC[] = "\006""Optima\0""Minima";
|
||||
|
||||
const mm_protocol_definition multi_protocols[] = {
|
||||
|
||||
|
||||
@@ -182,10 +182,10 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define POS_HORZ_INIT(posVert) 0
|
||||
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
{
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
@@ -275,7 +275,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (cc != curr) {
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu(menuTab[cc]);
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
||||
@@ -339,7 +339,7 @@ int8_t navigate(event_t event, int count, int rows, int columns, bool loop)
|
||||
return (prevPosHorz != menuHorizontalPosition || prevPosVert != menuVerticalPosition) ? result : 0;
|
||||
}
|
||||
|
||||
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
|
||||
bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, int rowcount, uint8_t flags)
|
||||
{
|
||||
uint8_t maxcol = MAXCOL(menuVerticalPosition);
|
||||
|
||||
@@ -372,7 +372,7 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (cc != curr) {
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu(menuTab[cc]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,13 +240,13 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL_RAW(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
||||
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
|
||||
#define MENU_FIRST_LINE_EDIT (menuTab ? (MAXCOL((uint16_t)0) >= HIDDEN_ROW ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? 2 : 1) : 0) : 0)
|
||||
#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0)
|
||||
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount)
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t menuTabSize, const uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount)
|
||||
{
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
@@ -273,7 +273,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (!menuCalibrationState && cc != curr) {
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu(menuTab[cc]);
|
||||
}
|
||||
|
||||
drawScreenIndex(curr, menuTabSize, 0);
|
||||
|
||||
@@ -316,7 +316,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
}
|
||||
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL_RAW(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
||||
#define COLATTR(row) (MAXCOL_RAW(row) == (uint8_t)-1 ? (const uint8_t)0 : (const uint8_t)(MAXCOL_RAW(row) & NAVIGATION_LINE_BY_LINE))
|
||||
#define INC(val, min, max) if (val<max) {val++;} else if (max>min) {val=min;}
|
||||
@@ -336,7 +336,7 @@ void onLongMenuPress(const char * result)
|
||||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
@@ -377,7 +377,7 @@ void check(const char * name, event_t event, uint8_t curr, const MenuHandlerFunc
|
||||
}
|
||||
|
||||
if (!menuCalibrationState && cc != curr) {
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu(menuTab[cc]);
|
||||
}
|
||||
|
||||
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
||||
|
||||
@@ -302,11 +302,11 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL_RAW(row) (horTab ? *(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (MAXCOL_RAW(row) >= HIDDEN_ROW ? MAXCOL_RAW(row) : (const uint8_t)(MAXCOL_RAW(row) & (~NAVIGATION_LINE_BY_LINE)))
|
||||
#define POS_HORZ_INIT(posVert) 0
|
||||
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t menuTabSize, const uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
{
|
||||
vertpos_t l_posVert = menuVerticalPosition;
|
||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||
@@ -362,7 +362,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (cc != curr) {
|
||||
chainMenu((MenuHandlerFunc)pgm_read_adr(&menuTab[cc]));
|
||||
chainMenu(menuTab[cc]);
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
||||
@@ -38,7 +38,7 @@ const char * writeScreenshot()
|
||||
char filename[42]; // /SCREENSHOTS/screen-2013-01-01-123540.bmp
|
||||
|
||||
// check and create folder here
|
||||
strcpy_P(filename, SCREENSHOTS_PATH);
|
||||
strcpy(filename, SCREENSHOTS_PATH);
|
||||
const char * error = sdCheckAndCreateDirectory(filename);
|
||||
if (error) {
|
||||
return error;
|
||||
|
||||
@@ -138,7 +138,7 @@ bool sportWaitState(SportUpdateState state, int timeout)
|
||||
else if (sportUpdateState == SPORT_FAIL) {
|
||||
return false;
|
||||
}
|
||||
CoTickDelay(1);
|
||||
RTOS_WAIT_TICKS(1);
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
@@ -313,7 +313,7 @@ void sportFlashDevice(ModuleIndex module, const char * filename)
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
CoTickDelay(1000);
|
||||
RTOS_WAIT_MS(2000);
|
||||
#endif
|
||||
|
||||
const char * result = sportUpdatePowerOn(module);
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ void killEvents(event_t event)
|
||||
bool clearKeyEvents()
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
CoTickDelay(100); // 200ms
|
||||
RTOS_WAIT_MS(200); // 200ms
|
||||
#endif
|
||||
|
||||
// loop until all keys are up
|
||||
|
||||
+7
-7
@@ -22,7 +22,7 @@
|
||||
#include "ff.h"
|
||||
|
||||
FIL g_oLogFile __DMA;
|
||||
const pm_char * g_logError = NULL;
|
||||
const char * g_logError = NULL;
|
||||
uint8_t logDelay;
|
||||
|
||||
void writeHeader();
|
||||
@@ -41,7 +41,7 @@ void logsInit()
|
||||
memset(&g_oLogFile, 0, sizeof(g_oLogFile));
|
||||
}
|
||||
|
||||
const pm_char * logsOpen()
|
||||
const char * logsOpen()
|
||||
{
|
||||
// Determine and set log file filename
|
||||
FRESULT result;
|
||||
@@ -54,7 +54,7 @@ const pm_char * logsOpen()
|
||||
return STR_SDCARD_FULL;
|
||||
|
||||
// check and create folder here
|
||||
strcpy_P(filename, STR_LOGS_PATH);
|
||||
strcpy(filename, STR_LOGS_PATH);
|
||||
const char * error = sdCheckAndCreateDirectory(filename);
|
||||
if (error) {
|
||||
return error;
|
||||
@@ -85,7 +85,7 @@ const pm_char * logsOpen()
|
||||
// TODO
|
||||
uint8_t num = 1;
|
||||
#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) + 1] = (char)((num % 10) + '0');
|
||||
len = sizeof(LOGS_PATH) + PSIZE(TR_MODEL) + 2;
|
||||
@@ -97,7 +97,7 @@ const pm_char * logsOpen()
|
||||
tmp = strAppendDate(&filename[len]);
|
||||
#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);
|
||||
if (result != FR_OK) {
|
||||
@@ -192,7 +192,7 @@ uint32_t getLogicalSwitchesStates(uint8_t first)
|
||||
|
||||
void logsWrite()
|
||||
{
|
||||
static const pm_char * error_displayed = NULL;
|
||||
static const char * error_displayed = NULL;
|
||||
|
||||
if (isFunctionActive(FUNCTION_LOGS) && logDelay > 0) {
|
||||
tmr10ms_t tmr10ms = get_tmr10ms();
|
||||
@@ -200,7 +200,7 @@ void logsWrite()
|
||||
lastLogTime = tmr10ms;
|
||||
|
||||
if (!g_oLogFile.obj.fs) {
|
||||
const pm_char * result = logsOpen();
|
||||
const char * result = logsOpen();
|
||||
if (result != NULL) {
|
||||
if (result != error_displayed) {
|
||||
error_displayed = result;
|
||||
|
||||
@@ -423,13 +423,6 @@ void perMain()
|
||||
|
||||
event_t evt = getEvent(false);
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
uint8_t sticks_evt = getSticksNavigationEvent();
|
||||
if (sticks_evt) {
|
||||
evt = sticks_evt;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RAMBACKUP)
|
||||
if (unexpectedShutdown) {
|
||||
drawFatalErrorScreen(STR_EMERGENCY_MODE);
|
||||
|
||||
+1
-5
@@ -143,7 +143,7 @@ int expo(int x, int k)
|
||||
return neg ? -y : y;
|
||||
}
|
||||
|
||||
void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||
void applyExpos(int16_t * anas, uint8_t mode, uint8_t ovwrIdx, int16_t ovwrValue)
|
||||
{
|
||||
int8_t cur_chn = -1;
|
||||
|
||||
@@ -969,9 +969,7 @@ void evalMixes(uint8_t tick10ms)
|
||||
// must be done after mixing because some functions use the inputs/channels values
|
||||
// must be done before limits because of the applyLimit function: it checks for safety switches which would be not initialized otherwise
|
||||
if (tick10ms) {
|
||||
#if defined(MASTER_VOLUME)
|
||||
requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF;
|
||||
#endif
|
||||
|
||||
if (!g_model.noGlobalFunctions) {
|
||||
evalFunctions(g_eeGeneral.customFn, globalFunctionsContext);
|
||||
@@ -992,9 +990,7 @@ void evalMixes(uint8_t tick10ms)
|
||||
|
||||
int16_t value = applyLimits(i, q); // applyLimits will remove the 256 100% basis
|
||||
|
||||
cli();
|
||||
channelOutputs[i] = value; // copy consistent word to int-level
|
||||
sei();
|
||||
}
|
||||
|
||||
if (tick10ms && flightModesFade) {
|
||||
|
||||
+24
-200
@@ -48,7 +48,7 @@ union ReusableBuffer reusableBuffer __DMA;
|
||||
uint8_t* MSC_BOT_Data = reusableBuffer.MSC_BOT_Data;
|
||||
#endif
|
||||
|
||||
const pm_uint8_t bchout_ar[] PROGMEM = {
|
||||
const uint8_t bchout_ar[] = {
|
||||
0x1B, 0x1E, 0x27, 0x2D, 0x36, 0x39,
|
||||
0x4B, 0x4E, 0x63, 0x6C, 0x72, 0x78,
|
||||
0x87, 0x8D, 0x93, 0x9C, 0xB1, 0xB4,
|
||||
@@ -56,7 +56,7 @@ const pm_uint8_t bchout_ar[] PROGMEM = {
|
||||
|
||||
uint8_t channel_order(uint8_t x)
|
||||
{
|
||||
return ( ((pgm_read_byte(bchout_ar + g_eeGeneral.templateSetup) >> (6-(x-1) * 2)) & 3 ) + 1 );
|
||||
return ( ((*(bchout_ar + g_eeGeneral.templateSetup) >> (6-(x-1) * 2)) & 3 ) + 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -65,7 +65,7 @@ mode2 rud thr ele ail
|
||||
mode3 ail ele thr rud
|
||||
mode4 ail thr ele rud
|
||||
*/
|
||||
const pm_uint8_t modn12x3[] PROGMEM = {
|
||||
const uint8_t modn12x3[] = {
|
||||
0, 1, 2, 3,
|
||||
0, 2, 1, 3,
|
||||
3, 1, 2, 0,
|
||||
@@ -667,11 +667,6 @@ getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value)
|
||||
return value;
|
||||
}
|
||||
|
||||
getvalue_t convert8bitsTelemValue(source_t channel, ls_telemetry_value_t value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
ls_telemetry_value_t minTelemValue(source_t channel)
|
||||
{
|
||||
@@ -684,13 +679,6 @@ ls_telemetry_value_t maxTelemValue(source_t channel)
|
||||
}
|
||||
#endif
|
||||
|
||||
ls_telemetry_value_t max8bitsTelemValue(source_t channel)
|
||||
{
|
||||
return 30000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define INAC_STICKS_SHIFT 6
|
||||
#define INAC_SWITCHES_SHIFT 8
|
||||
bool inputsMoved()
|
||||
@@ -770,8 +758,7 @@ void doSplash()
|
||||
backlightOn();
|
||||
drawSplash();
|
||||
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#if defined(PCBSKY9X)
|
||||
tmr10ms_t curTime = get_tmr10ms() + 10;
|
||||
uint8_t contrast = 10;
|
||||
lcdSetRefVolt(contrast);
|
||||
@@ -784,25 +771,12 @@ void doSplash()
|
||||
tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT;
|
||||
|
||||
while (tgtime > get_tmr10ms()) {
|
||||
#if defined(SIMU)
|
||||
SIMU_SLEEP(1);
|
||||
#else
|
||||
CoTickDelay(1);
|
||||
#endif
|
||||
RTOS_WAIT_TICKS(1);
|
||||
|
||||
getADC();
|
||||
|
||||
#if defined(FSPLASH)
|
||||
// Splash is forced, we can't skip it
|
||||
if (!(g_eeGeneral.splashMode & 0x04)) {
|
||||
#endif
|
||||
|
||||
if (keyDown() || inputsMoved()) return;
|
||||
|
||||
#if defined(FSPLASH)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
uint32_t pwr_check = pwrCheck();
|
||||
if (pwr_check == e_power_off) {
|
||||
@@ -924,11 +898,7 @@ void checkAll()
|
||||
showMessageBox(STR_KEYSTUCK);
|
||||
tmr10ms_t tgtime = get_tmr10ms() + 500;
|
||||
while (tgtime != get_tmr10ms()) {
|
||||
#if defined(SIMU)
|
||||
SIMU_SLEEP(1);
|
||||
#else
|
||||
CoTickDelay(1);
|
||||
#endif
|
||||
RTOS_WAIT_MS(1);
|
||||
wdt_reset();
|
||||
}
|
||||
}
|
||||
@@ -1017,9 +987,7 @@ void checkTHR()
|
||||
|
||||
wdt_reset();
|
||||
|
||||
SIMU_SLEEP(1);
|
||||
CoTickDelay(10);
|
||||
|
||||
RTOS_WAIT_MS(10);
|
||||
}
|
||||
|
||||
LED_ERROR_END();
|
||||
@@ -1036,7 +1004,7 @@ void checkAlarm() // added by Gohst
|
||||
}
|
||||
}
|
||||
|
||||
void alert(const pm_char * title, const pm_char * msg , uint8_t sound)
|
||||
void alert(const char * title, const char * msg , uint8_t sound)
|
||||
{
|
||||
LED_ERROR_BEGIN();
|
||||
|
||||
@@ -1049,8 +1017,7 @@ void alert(const pm_char * title, const pm_char * msg , uint8_t sound)
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
SIMU_SLEEP(1);
|
||||
CoTickDelay(10);
|
||||
RTOS_WAIT_MS(10);
|
||||
|
||||
if (keyDown()) break; // wait for key release
|
||||
|
||||
@@ -1200,10 +1167,6 @@ void checkTrims()
|
||||
uint16_t s_anaFilt[NUM_ANALOGS];
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
uint16_t BandGap = 225;
|
||||
#endif
|
||||
|
||||
#if defined(JITTER_MEASURE)
|
||||
JitterMeter<uint16_t> rawJitter[NUM_ANALOGS];
|
||||
JitterMeter<uint16_t> avgJitter[NUM_ANALOGS];
|
||||
@@ -1424,17 +1387,8 @@ void doMixerCalculations()
|
||||
evalMixes(tick10ms);
|
||||
DEBUG_TIMER_STOP(debugTimerEvalMixes);
|
||||
|
||||
|
||||
DEBUG_TIMER_START(debugTimerMixes10ms);
|
||||
if (tick10ms) {
|
||||
|
||||
#if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER)
|
||||
// code cost is about 16 bytes for higher throttle accuracy for timer
|
||||
// would not be noticable anyway, because all version up to this change had only 16 steps;
|
||||
// now it has already 32 steps; this define would increase to 128 steps
|
||||
#define ACCURAT_THROTTLE_TIMER
|
||||
#endif
|
||||
|
||||
/* Throttle trace */
|
||||
int16_t val;
|
||||
|
||||
@@ -1442,7 +1396,7 @@ void doMixerCalculations()
|
||||
uint8_t ch = g_model.thrTraceSrc-NUM_POTS-NUM_SLIDERS-1;
|
||||
val = channelOutputs[ch];
|
||||
|
||||
LimitData *lim = limitAddress(ch);
|
||||
LimitData * lim = limitAddress(ch);
|
||||
int16_t gModelMax = LIMIT_MAX_RESX(lim);
|
||||
int16_t gModelMin = LIMIT_MIN_RESX(lim);
|
||||
|
||||
@@ -1460,29 +1414,17 @@ void doMixerCalculations()
|
||||
gModelMax -= gModelMin; // we compare difference between Max and Mix for recaling needed; Max and Min are shifted to 0 by default
|
||||
// usually max is 1024 min is -1024 --> max-min = 2048 full range
|
||||
|
||||
#ifdef ACCURAT_THROTTLE_TIMER
|
||||
if (gModelMax!=0 && gModelMax!=2048) val = (int32_t) (val << 11) / (gModelMax); // rescaling only needed if Min, Max differs
|
||||
#else
|
||||
// @@@ open.20.fsguruh optimized calculation; now *8 /8 instead of 10 base; (*16/16 already cause a overrun; unsigned calculation also not possible, because v may be negative)
|
||||
gModelMax+=255; // force rounding up --> gModelMax is bigger --> val is smaller
|
||||
gModelMax >>= (10-2);
|
||||
if (gModelMax != 0 && gModelMax != 2048)
|
||||
val = (int32_t) (val << 11) / (gModelMax); // rescaling only needed if Min, Max differs
|
||||
|
||||
if (gModelMax!=0 && gModelMax!=8) {
|
||||
val = (val << 3) / gModelMax; // rescaling only needed if Min, Max differs
|
||||
}
|
||||
#endif
|
||||
|
||||
if (val<0) val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
|
||||
if (val < 0)
|
||||
val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
|
||||
}
|
||||
else {
|
||||
val = RESX + calibratedAnalogs[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
|
||||
}
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
val >>= (RESX_SHIFT-6); // calibrate it (resolution increased by factor 4)
|
||||
#else
|
||||
val >>= (RESX_SHIFT-4); // calibrate it
|
||||
#endif
|
||||
|
||||
evalTimers(val, tick10ms);
|
||||
|
||||
@@ -1504,11 +1446,8 @@ void doMixerCalculations()
|
||||
if (s_cnt_1s >= 10) { // 1sec
|
||||
s_cnt_1s -= 10;
|
||||
sessionTimer += 1;
|
||||
|
||||
struct t_inactivity *ptrInactivity = &inactivity;
|
||||
FORCE_INDIRECT(ptrInactivity) ;
|
||||
ptrInactivity->counter++;
|
||||
if ((((uint8_t)ptrInactivity->counter)&0x07)==0x01 && g_eeGeneral.inactivityTimer && g_vbat100mV>50 && ptrInactivity->counter > ((uint16_t)g_eeGeneral.inactivityTimer*60))
|
||||
inactivity.counter++;
|
||||
if ((((uint8_t)inactivity.counter)&0x07)==0x01 && g_eeGeneral.inactivityTimer && g_vbat100mV>50 && inactivity.counter > ((uint16_t)g_eeGeneral.inactivityTimer*60))
|
||||
AUDIO_INACTIVITY();
|
||||
|
||||
#if defined(AUDIO)
|
||||
@@ -1517,16 +1456,10 @@ void doMixerCalculations()
|
||||
if (mixWarning & 4) if ((sessionTimer&0x03)==2) AUDIO_MIX_WARNING(3);
|
||||
#endif
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
val = s_sum_samples_thr_1s / s_cnt_samples_thr_1s;
|
||||
s_timeCum16ThrP += (val>>3); // s_timeCum16ThrP would overrun if we would store throttle value with higher accuracy; therefore stay with 16 steps
|
||||
if (val) s_timeCumThr += 1;
|
||||
s_sum_samples_thr_1s>>=2; // correct better accuracy now, because trace graph can show this information; in case thrtrace is not active, the compile should remove this
|
||||
#else
|
||||
val = s_sum_samples_thr_1s / s_cnt_samples_thr_1s;
|
||||
s_timeCum16ThrP += (val>>1);
|
||||
if (val) s_timeCumThr += 1;
|
||||
#endif
|
||||
|
||||
#if defined(THRTRACE)
|
||||
// throttle trace is done every 10 seconds; Tracebuffer is adjusted to screen size.
|
||||
@@ -1573,36 +1506,7 @@ void doMixerCalculations()
|
||||
s_mixer_first_run_done = true;
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
uint8_t StickScrollAllowed;
|
||||
uint8_t StickScrollTimer;
|
||||
static const pm_uint8_t rate[] PROGMEM = { 0, 0, 100, 40, 16, 7, 3, 1 } ;
|
||||
|
||||
uint8_t calcStickScroll( uint8_t index )
|
||||
{
|
||||
uint8_t direction;
|
||||
int8_t value;
|
||||
|
||||
if ( ( g_eeGeneral.stickMode & 1 ) == 0 )
|
||||
index ^= 3;
|
||||
|
||||
value = calibratedAnalogs[index] / 128;
|
||||
direction = value > 0 ? 0x80 : 0;
|
||||
if (value < 0)
|
||||
value = -value; // (abs)
|
||||
if (value > 7)
|
||||
value = 7;
|
||||
value = pgm_read_byte(rate+(uint8_t)value);
|
||||
if (value)
|
||||
StickScrollTimer = STICK_SCROLL_TIMEOUT; // Seconds
|
||||
return value | direction;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define OPENTX_START_ARGS uint8_t splash=true
|
||||
#define OPENTX_START_SPLASH_NEEDED() (splash)
|
||||
|
||||
void opentxStart(OPENTX_START_ARGS)
|
||||
void opentxStart(uint8_t splash=true)
|
||||
{
|
||||
TRACE("opentxStart");
|
||||
|
||||
@@ -1615,7 +1519,7 @@ void opentxStart(OPENTX_START_ARGS)
|
||||
uint8_t calibration_needed = (g_eeGeneral.chkSum != evalChkSum());
|
||||
|
||||
#if defined(GUI)
|
||||
if (!calibration_needed && OPENTX_START_SPLASH_NEEDED()) {
|
||||
if (!calibration_needed && splash) {
|
||||
doSplash();
|
||||
}
|
||||
#endif
|
||||
@@ -1626,7 +1530,7 @@ void opentxStart(OPENTX_START_ARGS)
|
||||
|
||||
#if defined(PCBSKY9X) && defined(SDCARD) && !defined(SIMU)
|
||||
for (int i=0; i<500 && !Card_initialized; i++) {
|
||||
CoTickDelay(1); // 2ms
|
||||
RTOS_WAIT_MS(2); // 2ms
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1693,9 +1597,10 @@ void opentxClose(uint8_t shutdown)
|
||||
storageCheck(true);
|
||||
|
||||
while (IS_PLAYING(ID_PLAY_PROMPT_BASE + AU_BYE)) {
|
||||
CoTickDelay(10);
|
||||
RTOS_WAIT_MS(10);
|
||||
}
|
||||
CoTickDelay(50);
|
||||
|
||||
RTOS_WAIT_MS(100);
|
||||
|
||||
#if defined(SDCARD)
|
||||
sdDone();
|
||||
@@ -1727,81 +1632,7 @@ void opentxResume()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
uint8_t getSticksNavigationEvent()
|
||||
{
|
||||
uint8_t evt = 0;
|
||||
if (StickScrollAllowed) {
|
||||
if ( StickScrollTimer ) {
|
||||
static uint8_t repeater;
|
||||
uint8_t direction;
|
||||
uint8_t value;
|
||||
|
||||
if ( repeater < 128 )
|
||||
{
|
||||
repeater += 1;
|
||||
}
|
||||
value = calcStickScroll( 2 );
|
||||
direction = value & 0x80;
|
||||
value &= 0x7F;
|
||||
if ( value )
|
||||
{
|
||||
if ( repeater > value )
|
||||
{
|
||||
repeater = 0;
|
||||
if ( evt == 0 )
|
||||
{
|
||||
if ( direction )
|
||||
{
|
||||
evt = EVT_KEY_FIRST(KEY_UP);
|
||||
}
|
||||
else
|
||||
{
|
||||
evt = EVT_KEY_FIRST(KEY_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = calcStickScroll( 3 );
|
||||
direction = value & 0x80;
|
||||
value &= 0x7F;
|
||||
if ( value )
|
||||
{
|
||||
if ( repeater > value )
|
||||
{
|
||||
repeater = 0;
|
||||
if ( evt == 0 )
|
||||
{
|
||||
if ( direction )
|
||||
{
|
||||
evt = EVT_KEY_FIRST(KEY_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
evt = EVT_KEY_FIRST(KEY_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
StickScrollTimer = 0; // Seconds
|
||||
}
|
||||
StickScrollAllowed = 1 ;
|
||||
return evt;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define INSTANT_TRIM_MARGIN 10 /* around 1% */
|
||||
#define INSTANT_TRIM_MARGIN 10 /* around 1% */
|
||||
|
||||
void instantTrim()
|
||||
{
|
||||
@@ -2118,17 +1949,10 @@ int main()
|
||||
drawSplash();
|
||||
#endif
|
||||
|
||||
sei(); // interrupts needed now
|
||||
|
||||
|
||||
#if defined(DSM2_SERIAL) && !defined(TELEMETRY_FRSKY)
|
||||
DSM2_Init();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(MENU_ROTARY_SW)
|
||||
init_rotary_sw();
|
||||
#endif
|
||||
@@ -2265,7 +2089,7 @@ uint32_t pwrCheck()
|
||||
RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED);
|
||||
while (TELEMETRY_STREAMING()) {
|
||||
resetForcePowerOffRequest();
|
||||
CoTickDelay(10);
|
||||
RTOS_WAIT_MS(20);
|
||||
if (pwrPressed()) {
|
||||
return e_power_on;
|
||||
}
|
||||
|
||||
+61
-166
@@ -87,7 +87,7 @@
|
||||
#define CASE_PWM_BACKLIGHT(x)
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
#define CASE_GPS(x) x,
|
||||
#else
|
||||
#define CASE_GPS(x)
|
||||
@@ -187,7 +187,7 @@
|
||||
#define IF_FAI_CHOICE(x)
|
||||
#endif
|
||||
|
||||
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && isFaiForbidden(idx))
|
||||
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && isFaiForbidden(idx))
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#if defined(X9E) && !defined(USEHORUSBT)
|
||||
@@ -202,17 +202,6 @@
|
||||
#define IS_SLAVE_TRAINER() (g_model.trainerMode == TRAINER_MODE_SLAVE)
|
||||
#endif
|
||||
|
||||
#define MASTER_VOLUME
|
||||
|
||||
#if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER)
|
||||
// code cost is about 16 bytes for higher throttle accuracy for timer
|
||||
// would not be noticable anyway, because all version up to this change had only 16 steps;
|
||||
// now it has already 32 steps; this define would increase to 128 steps
|
||||
#if !defined(ACCURAT_THROTTLE_TIMER)
|
||||
#define ACCURAT_THROTTLE_TIMER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// RESX range is used for internal calculation; The menu says -100.0 to 100.0; internally it is -1024 to 1024 to allow some optimizations
|
||||
#define RESX_SHIFT 10
|
||||
#define RESX 1024
|
||||
@@ -228,19 +217,6 @@
|
||||
|
||||
#if defined(SIMU)
|
||||
#include "targets/simu/simpgmspace.h"
|
||||
#else
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
typedef const uint16_t pm_uint16_t;
|
||||
typedef const uint8_t pm_uint8_t;
|
||||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
|
||||
#define PSTR(adr) adr
|
||||
#define PROGMEM
|
||||
#define pgm_read_adr(x) *(x)
|
||||
#define cli()
|
||||
#define sei()
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
@@ -260,7 +236,7 @@
|
||||
|
||||
#include "myeeprom.h"
|
||||
|
||||
#define memclear(p, s) memset(p, 0, s)
|
||||
#define memclear(p, s) memset(p, 0, s)
|
||||
|
||||
void memswap(void * a, void * b, uint8_t size);
|
||||
|
||||
@@ -311,20 +287,14 @@ void memswap(void * a, void * b, uint8_t size);
|
||||
#define PPM_CH_CENTER(ch) (PPM_CENTER)
|
||||
#endif
|
||||
|
||||
#include "fifo.h"
|
||||
#include "io/io_arm.h"
|
||||
// This doesn't need protection on this processor
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
#define get_tmr10ms() g_tmr10ms
|
||||
#include "fifo.h"
|
||||
#include "io/io_arm.h"
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
extern uint8_t StickScrollAllowed;
|
||||
extern uint8_t StickScrollTimer;
|
||||
#define STICK_SCROLL_TIMEOUT 9
|
||||
#define STICK_SCROLL_DISABLE() StickScrollAllowed = 0
|
||||
#else
|
||||
#define STICK_SCROLL_DISABLE()
|
||||
#endif
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
static inline tmr10ms_t get_tmr10ms()
|
||||
{
|
||||
return g_tmr10ms;
|
||||
}
|
||||
|
||||
#if defined(CLI)
|
||||
#include "cli.h"
|
||||
@@ -333,12 +303,10 @@ void memswap(void * a, void * b, uint8_t size);
|
||||
#include "timers.h"
|
||||
#include "storage/storage.h"
|
||||
#include "pulses/pulses.h"
|
||||
|
||||
#include "pulses/modules.h"
|
||||
|
||||
|
||||
#define MASK_CFN_TYPE uint64_t // current max = 64 function switches
|
||||
#define MASK_FUNC_TYPE uint32_t // current max = 32 functions
|
||||
#define MASK_CFN_TYPE uint64_t // current max = 64 function switches
|
||||
#define MASK_FUNC_TYPE uint32_t // current max = 32 functions
|
||||
|
||||
typedef struct {
|
||||
MASK_FUNC_TYPE activeFunctions;
|
||||
@@ -359,7 +327,6 @@ typedef struct {
|
||||
#include "strhelpers.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
#if !defined(SIMU)
|
||||
#define assert(x)
|
||||
#if !defined(DEBUG)
|
||||
@@ -367,8 +334,8 @@ typedef struct {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern const pm_uint8_t bchout_ar[];
|
||||
extern const pm_uint8_t modn12x3[];
|
||||
extern const uint8_t bchout_ar[];
|
||||
extern const uint8_t modn12x3[];
|
||||
|
||||
//convert from mode 1 to mode stickMode
|
||||
//NOTICE! => 0..3 -> 0..3
|
||||
@@ -376,7 +343,7 @@ extern const pm_uint8_t modn12x3[];
|
||||
#define ELE_STICK 1
|
||||
#define THR_STICK 2
|
||||
#define AIL_STICK 3
|
||||
#define CONVERT_MODE(x) (((x)<=AIL_STICK) ? pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + (x)) : (x) )
|
||||
#define CONVERT_MODE(x) (((x)<=AIL_STICK) ? *(modn12x3 + 4*g_eeGeneral.stickMode + (x)) : (x) )
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#define CONVERT_MODE_TRIMS(x) (((x) == RUD_STICK) ? AIL_STICK : ((x) == AIL_STICK) ? RUD_STICK : (x))
|
||||
@@ -398,8 +365,6 @@ extern uint8_t channel_order(uint8_t x);
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define SPLASH_TIMEOUT 0 /* we use the splash duration to load stuff from the SD */
|
||||
#elif defined(FSPLASH)
|
||||
#define SPLASH_TIMEOUT (g_eeGeneral.splashMode == 0 ? 60000/*infinite=10mn*/ : ((4*100) * (g_eeGeneral.splashMode & 0x03)))
|
||||
#elif defined(PCBTARANIS)
|
||||
#define SPLASH_TIMEOUT (g_eeGeneral.splashMode==-4 ? 1500 : (g_eeGeneral.splashMode<=0 ? (400-g_eeGeneral.splashMode*200) : (400-g_eeGeneral.splashMode*100)))
|
||||
#else
|
||||
@@ -490,7 +455,7 @@ uint16_t evalChkSum();
|
||||
#define ALERT(title, msg, sound) alert(title, msg, sound)
|
||||
#endif
|
||||
|
||||
void alert(const pm_char * t, const pm_char * s , uint8_t sound);
|
||||
void alert(const char * t, const char * s , uint8_t sound);
|
||||
|
||||
enum PerOutMode {
|
||||
e_perout_mode_normal = 0,
|
||||
@@ -501,25 +466,15 @@ enum PerOutMode {
|
||||
e_perout_mode_noinput = e_perout_mode_notrainer+e_perout_mode_notrims+e_perout_mode_nosticks
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Fiddle to force compiler to use a pointer
|
||||
#define FORCE_INDIRECT(ptr)
|
||||
|
||||
extern uint8_t mixerCurrentFlightMode;
|
||||
extern uint8_t lastFlightMode;
|
||||
extern uint8_t flightModeTransitionLast;
|
||||
|
||||
#define bitfield_channels_t uint32_t
|
||||
|
||||
#if defined(SIMU)
|
||||
inline int availableMemory() { return 1000; }
|
||||
#elif !defined(SIMU)
|
||||
extern unsigned char *heap;
|
||||
extern int _end;
|
||||
extern int _estack;
|
||||
extern int _main_stack_start;
|
||||
extern int _heap_end;
|
||||
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||
#endif
|
||||
@@ -529,9 +484,9 @@ void evalMixes(uint8_t tick10ms);
|
||||
void doMixerCalculations();
|
||||
void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms);
|
||||
|
||||
void checkTrims();
|
||||
void checkTrims();
|
||||
void perMain();
|
||||
NOINLINE void per10ms();
|
||||
void per10ms();
|
||||
|
||||
getvalue_t getValue(mixsrc_t i);
|
||||
|
||||
@@ -541,9 +496,9 @@ bool getSwitch(swsrc_t swtch, uint8_t flags=0);
|
||||
void logicalSwitchesTimerTick();
|
||||
void logicalSwitchesReset();
|
||||
|
||||
void evalLogicalSwitches(bool isCurrentPhase=true);
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
void getSwitchesPosition(bool startup);
|
||||
@@ -554,9 +509,9 @@ void logicalSwitchesReset();
|
||||
extern swarnstate_t switches_states;
|
||||
swsrc_t getMovedSwitch();
|
||||
|
||||
#define GET_MOVED_SOURCE_PARAMS uint8_t min
|
||||
int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS);
|
||||
#define GET_MOVED_SOURCE(min, max) getMovedSource(min)
|
||||
#define GET_MOVED_SOURCE_PARAMS uint8_t min
|
||||
int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS);
|
||||
#define GET_MOVED_SOURCE(min, max) getMovedSource(min)
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
extern uint8_t getFlightMode();
|
||||
@@ -564,7 +519,7 @@ swsrc_t getMovedSwitch();
|
||||
#define getFlightMode() 0
|
||||
#endif
|
||||
|
||||
#define getTrimFlightMode(phase, idx) (phase)
|
||||
#define getTrimFlightMode(phase, idx) (phase)
|
||||
|
||||
#if defined(GVARS)
|
||||
extern int8_t trimGvar[NUM_TRIMS];
|
||||
@@ -576,7 +531,7 @@ swsrc_t getMovedSwitch();
|
||||
trim_t getRawTrimValue(uint8_t phase, uint8_t idx);
|
||||
int getTrimValue(uint8_t phase, uint8_t idx);
|
||||
|
||||
bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||
bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int16_t getRotaryEncoder(uint8_t idx);
|
||||
@@ -598,12 +553,11 @@ extern uint16_t s_timeCumThr;
|
||||
extern uint16_t s_timeCum16ThrP;
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
||||
#endif
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
|
||||
extern uint8_t trimsDisplayTimer;
|
||||
extern uint8_t trimsDisplayMask;
|
||||
|
||||
@@ -613,8 +567,7 @@ extern uint8_t unexpectedShutdown;
|
||||
|
||||
extern uint16_t maxMixerDuration;
|
||||
|
||||
|
||||
#define DURATION_MS_PREC2(x) ((x)/20)
|
||||
#define DURATION_MS_PREC2(x) ((x)/20)
|
||||
|
||||
#if defined(THRTRACE)
|
||||
#if defined(COLORLCD)
|
||||
@@ -664,10 +617,16 @@ void checkSwitches();
|
||||
void checkAlarm();
|
||||
void checkAll();
|
||||
|
||||
#if !defined(SIMU)
|
||||
void getADC();
|
||||
#define GET_ADC_IF_MIXER_NOT_RUNNING() do { if (s_pulses_paused) getADC(); } while(0)
|
||||
#endif
|
||||
static inline void GET_ADC_IF_MIXER_NOT_RUNNING()
|
||||
{
|
||||
do {
|
||||
if (s_pulses_paused) {
|
||||
getADC();
|
||||
}
|
||||
}
|
||||
while(0);
|
||||
}
|
||||
|
||||
#include "sbus.h"
|
||||
|
||||
@@ -677,36 +636,32 @@ void doLoopCommonActions();
|
||||
|
||||
#define BITMASK(bit) (1<<(bit))
|
||||
|
||||
#if !defined(UNUSED)
|
||||
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
|
||||
#endif
|
||||
|
||||
/// returns the number of elements of an array
|
||||
#define DIM(arr) (sizeof((arr))/sizeof((arr)[0]))
|
||||
|
||||
template<class t> FORCEINLINE t min(t a, t b) { return a<b?a:b; }
|
||||
template<class t> FORCEINLINE t max(t a, t b) { return a>b?a:b; }
|
||||
template<class t> FORCEINLINE t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); }
|
||||
template<class t> FORCEINLINE t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
|
||||
template<class t> void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
||||
template<class t> inline t min(t a, t b) { return a<b?a:b; }
|
||||
template<class t> inline t max(t a, t b) { return a>b?a:b; }
|
||||
template<class t> inline t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); }
|
||||
template<class t> inline t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
|
||||
template<class t> inline void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
||||
|
||||
uint16_t isqrt32(uint32_t n);
|
||||
|
||||
#if !defined(BOOT)
|
||||
#if defined(BOOT)
|
||||
#define pauseMixerCalculations()
|
||||
#define resumeMixerCalculations()
|
||||
#else
|
||||
#include "tasks_arm.h"
|
||||
extern OS_MutexID mixerMutex;
|
||||
extern RTOS_MUTEX_HANDLE mixerMutex;
|
||||
inline void pauseMixerCalculations()
|
||||
{
|
||||
CoEnterMutexSection(mixerMutex);
|
||||
RTOS_LOCK_MUTEX(mixerMutex);
|
||||
}
|
||||
|
||||
inline void resumeMixerCalculations()
|
||||
{
|
||||
CoLeaveMutexSection(mixerMutex);
|
||||
RTOS_UNLOCK_MUTEX(mixerMutex);
|
||||
}
|
||||
#else
|
||||
#define pauseMixerCalculations()
|
||||
#define resumeMixerCalculations()
|
||||
#endif
|
||||
|
||||
void generalDefault();
|
||||
@@ -763,6 +718,7 @@ extern const char eeprom_stamp[];
|
||||
#else
|
||||
extern const char vers_stamp[];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer
|
||||
* @param buffer If non-null find the firmware version in the buffer instead
|
||||
@@ -781,16 +737,14 @@ extern uint8_t g_vbat100mV;
|
||||
|
||||
#define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms)
|
||||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t g_beepVal[5];
|
||||
|
||||
#include "trainer_input.h"
|
||||
|
||||
extern int32_t chans[MAX_OUTPUT_CHANNELS];
|
||||
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
|
||||
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
||||
extern uint16_t BandGap;
|
||||
|
||||
#define NUM_INPUTS (MAX_INPUTS)
|
||||
#define NUM_INPUTS (MAX_INPUTS)
|
||||
|
||||
int expo(int x, int k);
|
||||
|
||||
@@ -873,13 +827,10 @@ int8_t getCurveX(int noPoints, int point);
|
||||
void resetCustomCurveX(int8_t * points, int noPoints);
|
||||
bool moveCurve(uint8_t index, int8_t shift); // TODO bool?
|
||||
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS_INC , uint8_t ovwrIdx=0, int16_t ovwrValue=0
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS , uint8_t ovwrIdx, int16_t ovwrValue
|
||||
|
||||
void clearInputs();
|
||||
void defaultInputs();
|
||||
|
||||
void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS_INC);
|
||||
void applyExpos(int16_t * anas, uint8_t mode, uint8_t ovwrIdx=0, int16_t ovwrValue=0);
|
||||
int16_t applyLimits(uint8_t channel, int32_t value);
|
||||
|
||||
void evalInputs(uint8_t mode);
|
||||
@@ -902,7 +853,7 @@ LogicalSwitchData * lswAddress(uint8_t idx);
|
||||
|
||||
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
||||
// It's also easier to initialize them here.
|
||||
extern int8_t virtualInputsTrims[NUM_INPUTS];
|
||||
extern int8_t virtualInputsTrims[NUM_INPUTS];
|
||||
|
||||
extern int16_t anas [NUM_INPUTS];
|
||||
extern int16_t trims[NUM_TRIMS];
|
||||
@@ -912,17 +863,16 @@ extern uint8_t s_mixer_first_run_done;
|
||||
|
||||
void applyDefaultTemplate();
|
||||
|
||||
void incSubtrim(uint8_t idx, int16_t inc);
|
||||
void instantTrim();
|
||||
void evalTrims();
|
||||
void copyTrimsToOffset(uint8_t ch);
|
||||
void copySticksToOffset(uint8_t ch);
|
||||
void moveTrimsToOffsets();
|
||||
|
||||
#define ACTIVE_PHASES_TYPE uint16_t
|
||||
typedef uint16_t ACTIVE_PHASES_TYPE;
|
||||
#define DELAY_POS_SHIFT 0
|
||||
#define DELAY_POS_MARGIN 3
|
||||
#define delayval_t int16_t
|
||||
typedef int16_t delayval_t;
|
||||
PACK(typedef struct {
|
||||
uint16_t delay;
|
||||
int16_t now; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
@@ -1001,7 +951,6 @@ uint16_t crc16(const uint8_t * ptr, uint32_t len);
|
||||
#define PLAY_REPEAT(x) (x) /* Range 0 to 15 */
|
||||
#define PLAY_NOW 0x10
|
||||
#define PLAY_BACKGROUND 0x20
|
||||
#define PLAY_INCREMENT(x) ((uint8_t)(((uint8_t)x) << 6)) /* -1, 0, 1, 2 */
|
||||
|
||||
enum AUDIO_SOUNDS {
|
||||
AUDIO_HELLO,
|
||||
@@ -1163,7 +1112,6 @@ union ReusableBuffer
|
||||
uint8_t r9mPower;
|
||||
} modelsetup;
|
||||
|
||||
|
||||
// 103 bytes
|
||||
struct
|
||||
{
|
||||
@@ -1206,13 +1154,11 @@ union ReusableBuffer
|
||||
|
||||
extern union ReusableBuffer reusableBuffer;
|
||||
|
||||
void checkFlashOnBeep();
|
||||
|
||||
uint8_t zlen(const char *str, uint8_t size);
|
||||
bool zexist(const char *str, uint8_t size);
|
||||
unsigned int effectiveLen(const char * str, unsigned int size);
|
||||
char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defaultName=NULL, uint8_t defaultNameSize=0, uint8_t defaultIdx=0);
|
||||
#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, STR_FP, PSIZE(TR_FP), idx+1)
|
||||
#define strcatFlightmodeName(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, STR_FM, PSIZE(TR_FM), idx+1)
|
||||
#if defined(EEPROM)
|
||||
#define strcat_modelname(dest, idx) strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, STR_MODEL, PSIZE(TR_MODEL), idx+1)
|
||||
#define strcat_currentmodelname(dest) strcat_modelname(dest, g_eeGeneral.currModel)
|
||||
@@ -1223,36 +1169,7 @@ char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defa
|
||||
#define ZEXIST(s) zexist(s, sizeof(s))
|
||||
|
||||
// Stick tolerance varies between transmitters, Higher is better
|
||||
#if defined (PCB9XR) || defined (PCB9XR128)
|
||||
#define STICK_TOLERANCE 16
|
||||
#else
|
||||
#define STICK_TOLERANCE 64
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB) && defined(GAUGES)
|
||||
enum BarThresholdIdx {
|
||||
THLD_ALT,
|
||||
THLD_RPM,
|
||||
THLD_FUEL,
|
||||
THLD_T1,
|
||||
THLD_T2,
|
||||
THLD_SPEED,
|
||||
THLD_DIST,
|
||||
THLD_GPSALT,
|
||||
THLD_CELL,
|
||||
THLD_CELLS_SUM,
|
||||
THLD_VFAS,
|
||||
THLD_CURRENT,
|
||||
THLD_CONSUMPTION,
|
||||
THLD_MAX,
|
||||
};
|
||||
|
||||
#define FILL_THRESHOLD(idx, val) barsThresholds[idx] = (val)
|
||||
|
||||
extern bar_threshold_t barsThresholds[THLD_MAX];
|
||||
#else
|
||||
#define FILL_THRESHOLD(idx, val)
|
||||
#endif
|
||||
#define STICK_TOLERANCE 64
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
ls_telemetry_value_t minTelemValue(source_t channel);
|
||||
@@ -1263,17 +1180,9 @@ extern bar_threshold_t barsThresholds[THLD_MAX];
|
||||
#endif
|
||||
|
||||
getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value);
|
||||
ls_telemetry_value_t max8bitsTelemValue(source_t channel);
|
||||
|
||||
getvalue_t convert8bitsTelemValue(source_t channel, ls_telemetry_value_t value);
|
||||
getvalue_t convertLswTelemValue(LogicalSwitchData * cs);
|
||||
|
||||
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
|
||||
#define convertBarTelemValue(channel, value) convert8bitsTelemValue(channel, value)
|
||||
#define maxBarTelemValue(channel) max8bitsTelemValue(channel)
|
||||
|
||||
lcdint_t applyChannelRatio(source_t channel, lcdint_t val);
|
||||
#define ANA_CHANNEL_UNIT(channel) g_model.frsky.channels[channel].type
|
||||
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
|
||||
|
||||
inline int div_and_round(int num, int den)
|
||||
{
|
||||
@@ -1290,11 +1199,6 @@ inline int div_and_round(int num, int den)
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
|
||||
extern const pm_uint8_t bchunit_ar[];
|
||||
|
||||
#define FRSKY_MULTIPLIER_MAX 5
|
||||
|
||||
enum TelemetryViews {
|
||||
TELEMETRY_CUSTOM_SCREEN_1,
|
||||
TELEMETRY_CUSTOM_SCREEN_2,
|
||||
@@ -1304,7 +1208,6 @@ enum TelemetryViews {
|
||||
};
|
||||
|
||||
extern uint8_t s_frsky_view;
|
||||
|
||||
#endif
|
||||
|
||||
#define EARTH_RADIUSKM ((uint32_t)6371)
|
||||
@@ -1320,18 +1223,10 @@ void varioWakeup();
|
||||
#define IS_SOUND_OFF() (g_eeGeneral.beepMode == e_mode_quiet)
|
||||
#endif
|
||||
|
||||
#define IS_IMPERIAL_ENABLE() (g_eeGeneral.imperial)
|
||||
|
||||
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
|
||||
#define IS_GPS_AVAILABLE() IS_USR_PROTO_FRSKY_HUB()
|
||||
#else
|
||||
#define IS_GPS_AVAILABLE() (0)
|
||||
#endif
|
||||
#define IS_IMPERIAL_ENABLE() (g_eeGeneral.imperial)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
extern const pm_uchar logo_taranis[];
|
||||
extern const unsigned char logo_taranis[];
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
@@ -1392,7 +1287,7 @@ extern JitterMeter<uint16_t> avgJitter[NUM_ANALOGS];
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#include "bluetooth.h"
|
||||
#include "bluetooth.h"
|
||||
#endif
|
||||
|
||||
#endif // _OPENTX_H_
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
#ifndef _OTXTYPES_H_
|
||||
#define _OTXTYPES_H_
|
||||
|
||||
typedef uint32_t tmr10ms_t;
|
||||
typedef int32_t rotenc_t;
|
||||
typedef int32_t getvalue_t;
|
||||
typedef uint32_t mixsrc_t;
|
||||
typedef int32_t swsrc_t;
|
||||
typedef int16_t safetych_t;
|
||||
typedef uint16_t bar_threshold_t;
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef uint32_t tmr10ms_t;
|
||||
typedef int32_t rotenc_t;
|
||||
typedef int32_t getvalue_t;
|
||||
typedef uint32_t mixsrc_t;
|
||||
typedef int32_t swsrc_t;
|
||||
typedef int16_t safetych_t;
|
||||
typedef uint32_t bitfield_channels_t;
|
||||
|
||||
#endif // _OTXTYPES_H_
|
||||
|
||||
@@ -148,7 +148,7 @@ union ModulePulsesData {
|
||||
|
||||
PpmPulsesData<pulse_duration_t> ppm;
|
||||
CrossfirePulsesData crossfire;
|
||||
} __ALIGNED;
|
||||
} __ALIGNED(4);
|
||||
|
||||
/* The __ALIGNED keyword is required to align the struct inside the modulePulsesData below,
|
||||
* which is also defined to be __DMA (which includes __ALIGNED) aligned.
|
||||
|
||||
@@ -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>
|
||||
static inline void msleep(unsigned x)
|
||||
{
|
||||
usleep(1000 * x);
|
||||
}
|
||||
#else
|
||||
#include <windows.h>
|
||||
inline void msleep(unsigned x)
|
||||
{
|
||||
Sleep(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void RTOS_INIT()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void RTOS_START()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void RTOS_WAIT_MS(unsigned x)
|
||||
{
|
||||
msleep(x);
|
||||
}
|
||||
|
||||
static 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
|
||||
static inline void RTOS_CREATE_MUTEX(pthread_mutex_t &mutex)
|
||||
{
|
||||
mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
static inline void RTOS_LOCK_MUTEX(pthread_mutex_t &mutex)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
static inline void RTOS_UNLOCK_MUTEX(pthread_mutex_t &mutex)
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
static inline void RTOS_CREATE_FLAG(uint32_t &flag)
|
||||
{
|
||||
flag = 0; // TODO: real flags (use semaphores?)
|
||||
}
|
||||
|
||||
static 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
|
||||
static 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_
|
||||
+1
-1
@@ -107,7 +107,7 @@ uint32_t sdGetFreeSectors();
|
||||
const char * sdCheckAndCreateDirectory(const char * path);
|
||||
|
||||
#if !defined(BOOT)
|
||||
inline const pm_char * SDCARD_ERROR(FRESULT result)
|
||||
inline const char * SDCARD_ERROR(FRESULT result)
|
||||
{
|
||||
if (result == FR_NOT_READY)
|
||||
return STR_NO_SDCARD;
|
||||
|
||||
+6
-6
@@ -31,14 +31,14 @@
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
const pm_char vers_stamp[] PROGMEM = "VERS" TAB ": " "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
|
||||
const pm_char date_stamp[] PROGMEM = "DATE" TAB ": " DATE;
|
||||
const pm_char time_stamp[] PROGMEM = "TIME" TAB ": " TIME;
|
||||
const pm_char eeprom_stamp[] PROGMEM = "EEPR" TAB ": " EEPROM_STR;
|
||||
const char vers_stamp[] = "VERS" TAB ": " "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
|
||||
const char date_stamp[] = "DATE" TAB ": " DATE;
|
||||
const char time_stamp[] = "TIME" TAB ": " TIME;
|
||||
const char eeprom_stamp[] = "EEPR" TAB ": " EEPROM_STR;
|
||||
#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 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
|
||||
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 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
|
||||
|
||||
/**
|
||||
|
||||
@@ -1250,10 +1250,10 @@ bool eeConvert()
|
||||
const char *msg = NULL;
|
||||
|
||||
if (g_eeGeneral.version == 216) {
|
||||
msg = PSTR("EEprom Data v216");
|
||||
msg = "EEprom Data v216";
|
||||
}
|
||||
else if (g_eeGeneral.version == 217) {
|
||||
msg = PSTR("EEprom Data v217");
|
||||
msg = "EEprom Data v217";
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user