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

Merge branch 'next' into kilrah/extratrims

This commit is contained in:
Andre Bernet 2016-04-08 10:46:34 +04:00
commit 64a3c21c4e
156 changed files with 1798 additions and 1027 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 KiB

View file

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 335 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 293 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 674 B

After

Width:  |  Height:  |  Size: 674 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 807 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 980 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 811 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 575 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 686 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 800 B

After

Width:  |  Height:  |  Size: 800 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 860 B

After

Width:  |  Height:  |  Size: 860 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 545 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 400 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 549 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

Before After
Before After

View file

@ -1,3 +1,5 @@
local bitmap = 0
local function load()
lcd.setColor(TEXT_COLOR_INDEX, WHITE)
lcd.setColor(TEXT_BGCOLOR_INDEX, BLACK)
@ -24,11 +26,14 @@ local function load()
lcd.setColor(HEADER_ICON_BGCOLOR_INDEX, BLACK)
lcd.setColor(HEADER_CURRENT_BGCOLOR_INDEX, lcd.RGB(10, 78, 121))
lcd.setColor(OVERLAY_COLOR_INDEX, BLACK)
bitmap = lcd.loadBitmap("THEMES/TBS/thumb.bmp")
return 0
end
local function drawBackground()
lcd.drawFilledRectangle(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
lcd.drawBitmap(50, 50, bitmap)
end
local function drawTopbarBackground(icon)

View file

@ -20,6 +20,7 @@ option(AUTOSWITCH "Automatic switch detection in menus" ON)
option(JITTER_MEASURE "Enable ADC jitter measurement" OFF)
option(JITTER_FILTER "Enable ADC jitter filtering" ON)
option(WATCHDOG_DISABLED "Disable hardware Watchdog on Horus" OFF) # TODO remove it when it's OK
option(SIMU_AUDIO "Enable simulator audio" OFF)
enable_language(ASM)
set(OPT s)
@ -37,6 +38,7 @@ configure_file(stamp.h.in stamp.h @ONLY)
add_subdirectory(translations)
add_subdirectory(bitmaps)
add_subdirectory(fonts)
add_subdirectory(lua)
set(EEPROM_VARIANT 0)
@ -472,6 +474,10 @@ if(CPU_FAMILY STREQUAL STM32)
sbus.cpp
telemetry/crossfire.cpp
)
set(PULSES_SRC
${PULSES_SRC}
crossfire.cpp
)
endif()
if(ARCH STREQUAL ARM)
@ -485,6 +491,10 @@ if(ARCH STREQUAL ARM)
option(DEBUG_TRACE_BUFFER "Debug Trace Screen" OFF)
option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" OFF)
option(SUPPORT_D16_EU_ONLY "XJT module only supports D16-EU and LR12-EU" OFF) # TODO rename to XJT_EU_ONLY
option(DEBUG_INTERRUPTS "Count interrupts" OFF)
option(DEBUG_TASKS "Task switching statistics" OFF)
option(DEBUG_TIMERS "Time critical parts of the code" OFF)
if(TIMERS EQUAL 3)
add_definitions(-DTIMERS=3)
else()
@ -511,6 +521,18 @@ if(ARCH STREQUAL ARM)
if(DEBUG_TRACE_BUFFER)
add_definitions(-DDEBUG_TRACE_BUFFER)
endif()
if(DEBUG_INTERRUPTS)
add_definitions(-DDEBUG_INTERRUPTS)
set(DEBUG ON)
endif()
if(DEBUG_TASKS)
add_definitions(-DDEBUG_TASKS)
set(DEBUG ON)
endif()
if(DEBUG_TIMERS)
add_definitions(-DDEBUG_TIMERS)
set(DEBUG ON)
endif()
if(CLI)
add_definitions(-DCLI)
set(FIRMWARE_SRC ${FIRMWARE_SRC} cli.cpp)
@ -584,11 +606,11 @@ if(ARCH STREQUAL ARM)
${COOS_DIR}/portable/arch.c
)
set(PULSES_SRC
${PULSES_SRC}
pulses_arm.cpp
ppm_arm.cpp
pxx_arm.cpp
dsm2_arm.cpp
crossfire.cpp
)
else()
option(EXT "Telemetry protocol" OFF) # TODO rename this EXT option to TELEMETRY
@ -842,6 +864,10 @@ if(WATCHDOG_DISABLED)
add_definitions(-DWATCHDOG_DISABLED)
endif()
if(SIMU_AUDIO)
add_definitions(-DSIMU_AUDIO)
endif()
if(SDCARD)
add_definitions(-DSDCARD)
include_directories(${FATFS_DIR} ${FATFS_DIR}/option)

View file

@ -781,7 +781,7 @@ void AudioQueue::wakeup()
// TRACE("pushing buffer %d\n", bufferWIdx);
bufferWIdx = nextBufferIdx(bufferWIdx);
buffer->size = size;
buffer->state = audioPushBuffer(buffer) ? AUDIO_BUFFER_PLAYING : AUDIO_BUFFER_FILLED;
audioPushBuffer(buffer);
__enable_irq();
}
}
@ -1004,10 +1004,9 @@ void audioEvent(unsigned int index, unsigned int freq)
char filename[AUDIO_FILENAME_MAXLEN + 1];
if (index < AU_SPECIAL_SOUND_FIRST && isAudioFileReferenced(index, filename)) {
audioQueue.playFile(filename);
return;
}
else
#endif
if (index < AU_SPECIAL_SOUND_FIRST) {
switch (index) {
case AU_INACTIVITY:
audioQueue.playTone(2250, 80, 20, PLAY_REPEAT(2));
@ -1175,7 +1174,6 @@ void audioEvent(unsigned int index, unsigned int freq)
break;
}
}
}
}
void pushPrompt(uint16_t prompt, uint8_t id)

View file

@ -166,7 +166,7 @@ class MixedContext {
int mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade);
};
bool audioPushBuffer(AudioBuffer * buffer);
void audioPushBuffer(AudioBuffer * buffer);
class AudioQueue {
@ -174,7 +174,9 @@ class AudioQueue {
#if defined(SIMU_AUDIO)
friend void *audioThread(void *);
#endif
#if defined(CLI)
friend void printAudioVars();
#endif
public:
AudioQueue();

View file

@ -1,12 +1,3 @@
add_truetype_font_target(horus tinsize "DejaVu Sans" 9 False)
add_truetype_font_target(horus smlsize "DejaVu Sans" 13 False)
add_truetype_font_target(horus stdsize "DejaVu Sans" 16 False)
add_truetype_font_target(horus stdsizebold "DejaVu Sans" 16 True)
add_truetype_font_target(horus midsize "DejaVu Sans" 24 False)
add_truetype_font_target(horus dblsize "DejaVu Sans" 32 True)
add_truetype_font_target(horus xxlsize "DejaVu Sans" 48 False)
add_custom_target(ttf_horus_fonts DEPENDS ${ttf_horus_fonts_targets})
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_button_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/button/alpha_*.png" 480 4/4/4/4)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

View file

@ -357,6 +357,132 @@ int cliSet(const char ** argv)
return 0;
}
#if defined(DEBUG_INTERRUPTS)
void printInterrupts()
{
__disable_irq();
struct InterruptCounters ic = interruptCounters;
memset(&interruptCounters, 0, sizeof(interruptCounters));
interruptCounters.resetTime = get_tmr10ms();
__enable_irq();
serialPrint("Interrupts count in the last %u ms:", (get_tmr10ms() - ic.resetTime) * 10);
for(int n = 0; n < INT_LAST; n++) {
serialPrint("%s: %u", interruptNames[n], ic.cnt[n]);
}
}
#endif //#if defined(DEBUG_INTERRUPTS)
#if defined(DEBUG_TASKS)
void printTaskSwitchLog()
{
serialPrint("Tasks legend [<task_id>, <task name>]:");
for(int n = 0; n <= CFG_MAX_USER_TASKS+1; n++) {
if (0 == n) {
serialPrint("%d: Idle", n);
}
if (cliTaskId == n) {
serialPrint("%d: CLI", n);
}
else if (menusTaskId == n) {
serialPrint("%d: menus", n);
}
else if (mixerTaskId == n) {
serialPrint("%d: mixer", n);
}
else if (audioTaskId == n) {
serialPrint("%d: audio", n);
}
#if defined(BLUETOOTH)
else if (btTaskId == n) {
serialPrint("%d: BT", n);
}
#endif
}
serialCrlf();
serialPrint("Tasks switch log at %u [<time>, <task_id>]:", get_tmr10ms());
uint32_t lastSwitchTime = 0;
uint32_t * tsl = new uint32_t[DEBUG_TASKS_LOG_SIZE];
memcpy(tsl, taskSwitchLog, sizeof(taskSwitchLog));
uint32_t * p = tsl + taskSwitchLogPos;
uint32_t * end = tsl + DEBUG_TASKS_LOG_SIZE;
for(int n = 0; n < DEBUG_TASKS_LOG_SIZE; n++) {
uint32_t taskId = *p >> 24;
uint32_t switchTime = *p & 0xFFFFFF;
if (lastSwitchTime != switchTime) {
serialPrintf("\r\n%06x: ", switchTime);
lastSwitchTime = switchTime;
}
serialPrintf("%u ", taskId);
if ( ++p >= end ) {
p = tsl;
}
}
delete[] tsl;
serialCrlf();
}
#endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
void printDebugTime(uint32_t time)
{
if (time >= 30000) {
serialPrintf("%dms", time/1000);
}
else {
serialPrintf("%d.%03dms", time/1000, time%1000);
}
}
void printDebugTimer(const char * name, DebugTimer & timer)
{
serialPrintf("%s: ", name);
printDebugTime( timer.getMin());
serialPrintf(" - ");
printDebugTime(timer.getMax());
serialCrlf();
timer.reset();
}
void printDebugTimers()
{
for(int n = 0; n < DEBUG_TIMERS_COUNT; n++) {
printDebugTimer(debugTimerNames[n], debugTimers[n]);
}
}
#endif
#include "OsMutex.h"
extern OS_MutexID audioMutex;
void printAudioVars()
{
for(int n = 0; n < AUDIO_BUFFER_COUNT; n++) {
serialPrint("Audio Buffer %d: size: %u, state: %u, ", n, (uint32_t)audioBuffers[n].size, (uint32_t)audioBuffers[n].state);
dump((uint8_t *)audioBuffers[n].data, 32);
}
serialPrint("fragments:");
for(int n = 0; n < AUDIO_QUEUE_LENGTH; n++) {
serialPrint("%d: type %u: id: %u, repeat: %u, ", n, (uint32_t)audioQueue.fragments[n].type,
(uint32_t)audioQueue.fragments[n].id,
(uint32_t)audioQueue.fragments[n].repeat);
if ( audioQueue.fragments[n].type == FRAGMENT_FILE) {
serialPrint(" file: %s", audioQueue.fragments[n].file);
}
}
serialPrint("audioQueue:");
serialPrint(" ridx: %d, widx: %d", audioQueue.ridx, audioQueue.widx);
serialPrint(" bufferRIdx: %d, bufferWIdx: %d", audioQueue.bufferRIdx, audioQueue.bufferWIdx);
serialPrint("normalContext: %u", (uint32_t)audioQueue.normalContext.fragment.type);
serialPrint("audioMutex[%u] = %u", (uint32_t)audioMutex, (uint32_t)MutexTbl[audioMutex].mutexFlag);
}
int cliDisplay(const char ** argv)
{
long long int address = 0;
@ -461,6 +587,9 @@ int cliDisplay(const char ** argv)
case 2:
tim = TIM2;
break;
case 13:
tim = TIM13;
break;
default:
return 0;
}
@ -484,6 +613,24 @@ int cliDisplay(const char ** argv)
serialPrint(" CCR4 0x%x", tim->CCR4);
}
}
#if defined(DEBUG_INTERRUPTS)
else if (!strcmp(argv[1], "int")) {
printInterrupts();
}
#endif
#if defined(DEBUG_TASKS)
else if (!strcmp(argv[1], "tsl")) {
printTaskSwitchLog();
}
#endif
#if defined(DEBUG_TIMERS)
else if (!strcmp(argv[1], "dt")) {
printDebugTimers();
}
#endif
else if (!strcmp(argv[1], "audio")) {
printAudioVars();
}
else if (toLongLongInt(argv, 1, &address) > 0) {
int size = 256;
if (toInt(argv, 2, &size) >= 0) {
@ -555,6 +702,7 @@ const CliCommand cliCommands[] = {
{ "readsd", cliReadSD, "<start sector> <sectors count> <read buffer size (sectors)>" },
{ "play", cliPlay, "<filename>" },
{ "print", cliDisplay, "<address> [<size>] | <what>" },
{ "p", cliDisplay, "<address> [<size>] | <what>" },
{ "reboot", cliReboot, "[wdt]" },
{ "set", cliSet, "<what> <value>" },
{ "stackinfo", cliStackInfo, "" },

View file

@ -30,6 +30,7 @@ extern uint8_t cliTracesEnabled;
extern Fifo<uint8_t, 256> cliRxFifo;
#include "tasks_arm.h"
#define CLI_STACK_SIZE 1000
extern OS_TID cliTaskId;
extern TaskStack<CLI_STACK_SIZE> cliStack;
#endif

View file

@ -914,7 +914,8 @@ PACK(struct TrainerData {
NOBACKUP(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]); \
NOBACKUP(char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]); \
NOBACKUP(char currModelFilename[LEN_MODEL_FILENAME+1]); \
NOBACKUP(uint8_t bluetoothEnable); \
NOBACKUP(uint8_t bluetoothEnable:1); \
NOBACKUP(uint8_t blOffBright:7); \
NOBACKUP(char bluetoothName[LEN_BLUETOOTH_NAME]);
#elif defined(PCBFLAMENCO)
#define EXTRA_GENERAL_FIELDS \

View file

@ -102,3 +102,129 @@ void dumpTraceBuffer()
TRACE("End of Trace Buffer dump");
}
#endif
#if defined(DEBUG_INTERRUPTS)
#if defined(PCBHORUS)
const char * interruptNames[INT_LAST] = {
"Tick ", // INT_TICK,
"1ms ", // INT_1MS,
"Ser2 ", // INT_SER2,
"TelDm", // INT_TELEM_DMA,
"Sdio ", // INT_SDIO,
"SdDma", // INT_SDIO_DMA,
"D2S7 ", // INT_DMA2S7,
"Tim1 ", // INT_TIM1CC,
"Tim2 ", // INT_TIM2,
"Tim3 ", // INT_TIM3,
"Usb " // INT_OTG_FS,
};
#elif defined(PCBTARANIS)
const char * interruptNames[INT_LAST] = {
"Tick ", // INT_TICK,
"5ms ", // INT_5MS,
"Audio", // INT_AUDIO,
"BlueT", // INT_BLUETOOTH,
"Lcd ", // INT_LCD,
"T1CC ", // INT_TIM1CC,
"Tim1 ", // INT_TIM1,
"Tim8 ", // INT_TIM8,
"Ser2 ", // INT_SER2,
"TelDm", // INT_TELEM_DMA,
"TelUs", // INT_TELEM_USART,
"Train", // INT_TRAINER,
"Usb ", // INT_OTG_FS,
};
#endif
struct InterruptCounters interruptCounters;
#endif //#if defined(DEBUG_INTERRUPTS)
#if defined(DEBUG_TASKS)
uint32_t taskSwitchLog[DEBUG_TASKS_LOG_SIZE] __SDRAM;
uint16_t taskSwitchLogPos;
/**
*******************************************************************************
* @brief Hook for task switch logging
* @param[in] taskID Task which is now in RUNNING state
* @retval None
*
* @par Description
* @details This function logs the time when a task entered the RUNNING state.
*******************************************************************************
*/
void CoTaskSwitchHook(uint8_t taskID)
{
/* Log task switch here */
taskSwitchLog[taskSwitchLogPos] = (taskID << 24) + ((uint32_t)CoGetOSTime() & 0xFFFFFF);
if(++taskSwitchLogPos >= DEBUG_TASKS_LOG_SIZE) {
taskSwitchLogPos = 0;
}
}
#endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
void DebugTimer::start()
{
_start_hiprec = getTmr2MHz();
_start_loprec = get_tmr10ms();
}
void DebugTimer::stop()
{
// getTmr2MHz is 16 bit timer, resolution 0.5us, max measurable value 32.7675 milli seconds
// tmr10ms_t tmr10ms = get_tmr10ms(); 32 bit timer, resolution 10ms, max measurable value: 42949672.95 s = 1.3 years
// if time difference is bigger than 30ms, then use low resolution timer
// otherwise use high resolution
if ((_start_hiprec == 0) && (_start_loprec == 0)) return;
last = get_tmr10ms() - _start_loprec; //use low precision timer
if (last < 3) {
//use high precision
last = (uint16_t)(getTmr2MHz() - _start_hiprec) / 2;
}
else {
last *= 10000ul; //adjust unit to 1us
}
evalStats();
}
DebugTimer debugTimers[DEBUG_TIMERS_COUNT];
const char * debugTimerNames[DEBUG_TIMERS_COUNT] = {
"Pulses int." // debugTimerIntPulses,
,"Pulses dur." // debugTimerIntPulsesDuration,
,"10ms dur. " // debugTimerPer10ms,
,"Rotary enc." // debugTimerRotEnc,
,"Haptic " // debugTimerHaptic,
,"Mixer calc " // debugTimerMixer,
,"Tel. wakeup" // debugTimerTelemetryWakeup,
,"perMain dur" // debugTimerPerMain,
," perMain s1" // debugTimerPerMain1,
," guiMain " // debugTimerGuiMain,
," LUA bg " // debugTimerLuaBg,
," LCD wait " // debugTimerLcdRefreshWait,
," LUA fg " // debugTimerLuaFg,
," LCD refr." // debugTimerLcdRefresh,
," Menus " // debugTimerMenus,
," Menu hnd" // debugTimerMenuHandlers,
,"Menu Vers. " // debugTimerVersion,
,"Menu simple" // debugTimerSimpleMenu,
,"Menu drawte" // debugTimerDrawText,
,"Menu drawt1" // debugTimerDrawText1,
,"Mix ADC " // debugTimerGetAdc,
,"Mix getsw " // debugTimerGetSwitches,
,"Mix eval " // debugTimerEvalMixes,
,"Mix 10ms " // debugTimerMixes10ms,
,"ADC read " // debugTimerAdcRead,
,"ADC loop " // debugTimerAdcLoop,
,"ADC wait " // debugTimerAdcWait,
,"mix-pulses " // debugTimerMixerCalcToUsage
,"mix-int. " // debugTimerMixerIterval
};
#endif

View file

@ -54,7 +54,7 @@ uint8_t serial2TracesEnabled();
}
#endif
#define TRACE_PING(x) do { debugPrintf(x); } while(0)
#define TRACE_PING(...) do { debugPrintf(__VA_ARGS__); } while(0)
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
#define DUMP(data, size) dump(data, size)
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
@ -185,5 +185,168 @@ public:
#endif // defined(JITTER_MEASURE)
#if defined(DEBUG_INTERRUPTS) && !defined(BOOT)
#if defined(PCBHORUS)
enum InterruptNames {
INT_TICK,
INT_1MS,
INT_SER2,
INT_TELEM_DMA,
INT_SDIO,
INT_SDIO_DMA,
INT_DMA2S7,
INT_TIM1CC,
INT_TIM2,
INT_TIM3,
INT_OTG_FS,
INT_LAST
};
#elif defined(PCBTARANIS)
enum InterruptNames {
INT_TICK,
INT_5MS,
INT_AUDIO,
INT_BLUETOOTH,
INT_LCD,
INT_TIM1CC,
INT_TIM1,
INT_TIM8,
INT_SER2,
INT_TELEM_DMA,
INT_TELEM_USART,
INT_TRAINER,
INT_OTG_FS,
INT_LAST
};
#endif
struct InterruptCounters
{
uint32_t cnt[INT_LAST];
uint32_t resetTime;
};
extern const char * interruptNames[INT_LAST];
extern struct InterruptCounters interruptCounters;
#define DEBUG_INTERRUPT(int) (++interruptCounters.cnt[int])
#else
#define DEBUG_INTERRUPT(int)
#endif //#if defined(DEBUG_INTERRUPTS)
#if defined(DEBUG_TASKS)
#define DEBUG_TASKS_LOG_SIZE 512
// each 32bit is used as:
// top 8 bits: task id
// botom 24 bits: system tick counter
extern uint32_t taskSwitchLog[DEBUG_TASKS_LOG_SIZE];
extern uint16_t taskSwitchLogPos;
#if defined(__cplusplus)
extern "C" {
#endif
extern void CoTaskSwitchHook(uint8_t taskID);
#if defined(__cplusplus)
}
#endif
#endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
#if defined(__cplusplus)
typedef uint32_t debug_timer_t;
class DebugTimer
{
private:
debug_timer_t min;
debug_timer_t max;
// debug_timer_t avg;
debug_timer_t last; //unit 1us
uint16_t _start_hiprec;
uint32_t _start_loprec;
void evalStats() {
if (min > last) min = last;
if (max < last) max = last;
//todo avg
}
public:
DebugTimer(): min(-1), max(0), /*avg(0),*/ last(0), _start_hiprec(0), _start_loprec(0) {};
void start();
void stop();
void sample() { stop(); start(); }
void reset() { min = -1; max = last = 0; }
debug_timer_t getMin() const { return min; }
debug_timer_t getMax() const { return max; }
debug_timer_t getLast() const { return last; }
};
enum DebugTimers {
debugTimerIntPulses,
debugTimerIntPulsesDuration,
debugTimerPer10ms,
debugTimerRotEnc,
debugTimerHaptic,
debugTimerMixer,
debugTimerTelemetryWakeup,
debugTimerPerMain,
debugTimerPerMain1,
debugTimerGuiMain,
debugTimerLuaBg,
debugTimerLcdRefreshWait,
debugTimerLuaFg,
debugTimerLcdRefresh,
debugTimerMenus,
debugTimerMenuHandlers,
debugTimerVersion,
debugTimerSimpleMenu,
debugTimerDrawText,
debugTimerDrawText1,
debugTimerGetAdc,
debugTimerGetSwitches,
debugTimerEvalMixes,
debugTimerMixes10ms,
debugTimerAdcRead,
debugTimerAdcLoop,
debugTimerAdcWait,
debugTimerMixerCalcToUsage,
debugTimerMixerIterval,
DEBUG_TIMERS_COUNT
};
extern DebugTimer debugTimers[DEBUG_TIMERS_COUNT];
extern const char * debugTimerNames[DEBUG_TIMERS_COUNT];
#endif // #if defined(__cplusplus)
#define DEBUG_TIMER_START(timer) debugTimers[timer].start()
#define DEBUG_TIMER_STOP(timer) debugTimers[timer].stop()
#define DEBUG_TIMER_SAMPLE(timer) debugTimers[timer].sample()
#else //#if defined(DEBUG_TIMERS)
#define DEBUG_TIMER_START(timer)
#define DEBUG_TIMER_STOP(timer)
#define DEBUG_TIMER_SAMPLE(timer)
#endif //#if defined(DEBUG_TIMERS)
#endif // _DEBUG_H_

View file

@ -26,6 +26,9 @@
extern const uint16_t * const fontspecsTable[16];
extern const uint8_t * const fontsTable[16];
extern BitmapBuffer * fontCache[2];
void loadFontCache();
#else
extern const pm_uchar font_5x7[];

View file

@ -0,0 +1 @@
add_subdirectory(horus)

View file

@ -0,0 +1,10 @@
set(FONT "DejaVu Sans")
add_truetype_font_target(horus tinsize ${FONT} 9 False)
add_truetype_font_target(horus smlsize ${FONT} 13 False)
add_truetype_font_target(horus stdsize ${FONT} 16 False)
add_truetype_font_target(horus stdsizebold ${FONT} 16 True)
add_truetype_font_target(horus midsize ${FONT} 24 False)
add_truetype_font_target(horus dblsize ${FONT} 32 True)
add_truetype_font_target(horus xxlsize ${FONT} 48 False)
add_custom_target(ttf_horus_fonts DEPENDS ${ttf_horus_fonts_targets})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,14,28,54,76,110,139,146,160,173,193,217,228,242,251,266,289,310,331,352,375,397,420,441,464,487,497,508,532,556,580,598,613,641,665,689,715,736,757,783,808,818,832,859,880,910,935,963,987,1015,1040,1062,1087,1112,1140,1178,1206,1234,1258,1272,1287,1300,1324,1343,1356,1378,1401,1420,1443,1466,1484,1507,1529,1539,1553,1576,1586,1618,1640,1663,1686,1709,1726,1746,1764,1786,1810,1841,1865,1889,1909,1933,1936,1960,1988,2015,2033,2051,2074,2097,2120,2143,2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171
0,4,14,28,54,76,110,139,146,160,173,193,217,228,242,251,266,289,310,331,352,375,397,420,441,464,487,497,508,532,556,580,598,613,641,665,689,715,736,757,783,808,818,832,859,880,910,935,963,987,1015,1040,1062,1087,1112,1140,1178,1206,1234,1258,1272,1287,1300,1324,1343,1356,1378,1401,1420,1443,1466,1484,1507,1529,1539,1553,1576,1586,1618,1640,1663,1686,1709,1726,1746,1764,1786,1810,1841,1865,1889,1909,1933,1937,1961,1989,2016,2034,2052,2075,2098,2121,2144,2172,2172,2172,2172,2172,2172,2172,2172,2172,2172,2172,2172,2172,2195,2218,2240,2255,2274

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,10,20,41,56,80,100,106,115,125,140,159,167,177,184,196,212,227,242,258,274,290,306,322,338,354,361,369,388,407,426,440,451,471,487,505,524,539,553,572,589,595,605,623,638,658,675,695,710,730,747,763,782,799,819,845,864,883,901,910,922,931,950,967,976,991,1006,1020,1036,1052,1064,1080,1095,1101,1110,1125,1131,1154,1169,1185,1200,1216,1227,1241,1253,1268,1285,1306,1323,1340,1354,1373,1376,1395,1416,1437,1452,1467,1484,1501,1518,1535,1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557
0,4,10,20,41,56,80,100,106,115,125,140,159,167,177,184,196,212,227,242,258,274,290,306,322,338,354,361,369,388,407,426,440,451,471,487,505,524,539,553,572,589,595,605,623,638,658,675,695,710,730,747,763,782,799,819,845,864,883,901,910,922,931,950,967,976,991,1006,1020,1036,1052,1064,1080,1095,1101,1110,1125,1131,1154,1169,1185,1200,1216,1227,1241,1253,1268,1285,1306,1323,1340,1354,1373,1377,1396,1417,1438,1453,1468,1485,1502,1519,1536,1558,1558,1558,1558,1558,1558,1558,1558,1558,1558,1558,1558,1558,1574,1590,1605,1616,1630

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,8,13,23,31,44,55,58,63,67,75,85,88,94,97,103,112,120,128,137,146,154,163,171,180,189,192,195,205,215,225,232,238,248,256,266,276,284,291,301,310,313,318,327,335,345,354,365,373,384,393,402,412,421,431,445,455,465,475,479,485,489,499,508,513,521,529,537,546,555,561,570,578,581,586,594,597,609,617,626,634,643,649,657,663,671,680,692,701,710,718,728,729,739,751,763,771,779,789,799,809,819,830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830
0,4,8,13,23,31,44,55,58,63,67,75,85,88,94,97,103,112,120,128,137,146,154,163,171,180,189,192,195,205,215,225,232,238,248,256,266,276,284,291,301,310,313,318,327,335,345,354,365,373,384,393,402,412,421,431,445,455,465,475,479,485,489,499,508,513,521,529,537,546,555,561,570,578,581,586,594,597,609,617,626,634,643,649,657,663,671,680,692,701,710,718,728,732,742,754,766,774,782,792,802,812,822,833,833,833,833,833,833,833,833,833,833,833,833,833,842,851,859,865,873

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,7,13,26,35,51,63,66,71,76,85,97,101,107,111,118,128,137,146,155,166,175,185,194,204,214,218,222,234,246,258,266,273,285,295,307,319,329,338,351,362,366,372,383,392,405,416,429,439,452,463,473,485,496,508,525,537,549,561,566,573,578,590,601,607,617,627,636,646,656,663,673,682,685,690,700,703,718,727,737,747,757,764,773,780,789,799,813,823,833,842,854,855,867,881,895,904,913,924,935,946,957,971, 986, 1001, 1016, 1031, 1046, 1061, 1076, 1091, 1106, 1121, 1136, 1151, 1166
0,4,7,13,26,35,51,63,66,71,76,85,97,101,107,111,118,128,137,146,155,166,175,185,194,204,214,218,222,234,246,258,266,273,285,295,307,319,329,338,351,362,366,372,383,392,405,416,429,439,452,463,473,485,496,508,525,537,549,561,566,573,578,590,601,607,617,627,636,646,656,663,673,682,685,690,700,703,718,727,737,747,757,764,773,780,789,799,813,823,833,842,854,858,870,884,898,907,916,927,938,949,960,974,989,1004,1019,1034,1049,1064,1079,1094,1109,1124,1139,1154,1164,1174,1184,1191,1200

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,9,16,29,40,57,72,76,83,89,99,111,117,124,129,136,148,159,169,179,191,202,213,223,235,247,252,257,269,281,293,302,309,323,335,347,360,370,380,393,405,410,417,430,440,455,467,481,493,507,519,530,542,554,568,587,601,615,627,634,641,647,659,668,675,686,697,707,719,731,740,752,763,768,775,786,791,807,818,830,841,853,861,871,880,891,903,919,931,943,953,965,966,978,992,1006,1015,1024,1035,1046,1057,1068,1082, 1097, 1112, 1127, 1142, 1157, 1172, 1187, 1202, 1217, 1232, 1247, 1262, 1277
0,4,9,16,29,40,57,72,76,83,89,99,111,117,124,129,136,148,159,169,179,191,202,213,223,235,247,252,257,269,281,293,302,309,323,335,347,360,370,380,393,405,410,417,430,440,455,467,481,493,507,519,530,542,554,568,587,601,615,627,634,641,647,659,668,675,686,697,707,719,731,740,752,763,768,775,786,791,807,818,830,841,853,861,871,880,891,903,919,931,943,953,965,969,981,995,1009,1018,1027,1038,1049,1060,1071,1085,1100,1115,1130,1145,1160,1175,1190,1205,1220,1235,1250,1265,1277,1289,1300,1307,1317

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,7,12,20,26,36,44,47,51,55,61,69,72,76,79,84,91,97,103,109,116,122,129,135,142,149,151,154,162,170,178,184,189,197,204,211,219,226,232,240,247,250,254,262,268,276,283,291,298,306,313,320,328,335,343,353,360,368,375,379,384,388,396,403,407,413,420,426,432,439,444,450,456,459,463,470,473,482,488,495,502,508,513,519,524,530,537,545,552,559,565,573,574,582,591,600,606,612,619,626,633,640,648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648
0,4,7,12,20,26,36,44,47,51,55,61,69,72,76,79,84,91,97,103,109,116,122,129,135,142,149,151,154,162,170,178,184,189,197,204,211,219,226,232,240,247,250,254,262,268,276,283,291,298,306,313,320,328,335,343,353,360,368,375,379,384,388,396,403,407,413,420,426,432,439,444,450,456,459,463,470,473,482,488,495,502,508,513,519,524,530,537,545,552,559,565,573,577,585,594,603,609,615,622,629,636,643,651,651,651,651,651,651,651,651,651,651,651,651,651,658,665,671,676,682

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before After
Before After

View file

@ -1 +1 @@
0,4,12,29,66,93,137,173,181,195,210,235,269,280,296,305,325,353,378,404,431,460,487,515,542,570,598,607,618,652,686,720,743,762,798,827,859,893,920,944,979,1010,1019,1035,1067,1093,1129,1160,1197,1224,1261,1292,1320,1354,1384,1420,1468,1502,1536,1568,1582,1602,1616,1650,1679,1695,1722,1749,1774,1802,1830,1850,1878,1904,1912,1925,1952,1960,2002,2028,2056,2083,2111,2130,2154,2174,2200,2229,2268,2297,2326,2351,2385,2388,2422,2461,2500,2525,2550,2581,2612,2643,2674,2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714
0,4,12,29,66,93,137,173,181,195,210,235,269,280,296,305,325,353,378,404,431,460,487,515,542,570,598,607,618,652,686,720,743,762,798,827,859,893,920,944,979,1010,1019,1035,1067,1093,1129,1160,1197,1224,1261,1292,1320,1354,1384,1420,1468,1502,1536,1568,1582,1602,1616,1650,1679,1695,1722,1749,1774,1802,1830,1850,1878,1904,1912,1925,1952,1960,2002,2028,2056,2083,2111,2130,2154,2174,2200,2229,2268,2297,2326,2351,2385,2389,2423,2462,2501,2526,2551,2582,2613,2644,2675,2715,2715,2715,2715,2715,2715,2715,2715,2715,2715,2715,2715,2715,2743,2771,2798,2817,2842

View file

@ -222,6 +222,35 @@ void BitmapBuffer::drawPie(int x0, int y0, int radius, int startAngle, int endAn
}
}
void BitmapBuffer::drawMask(coord_t x, coord_t y, BitmapBuffer * mask, LcdFlags flags, coord_t offset, coord_t width)
{
if (mask == NULL) {
return;
}
coord_t w = mask->getWidth();
coord_t height = mask->getHeight();
if (!width || width > w) {
width = w;
}
if (x+width > this->width) {
width = this->width-x;
}
display_t color = lcdColorTable[COLOR_IDX(flags)];
for (coord_t row=0; row<height; row++) {
display_t * p = getPixelPtr(x, y+row);
display_t * q = mask->getPixelPtr(offset, row);
for (coord_t col=0; col<width; col++) {
drawAlphaPixel(p, *((uint8_t *)q), color);
p++; q++;
}
}
}
void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset, coord_t width)
{
coord_t w = *((uint16_t *)bmp);
@ -247,8 +276,7 @@ void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp,
}
}
#define FONT_MAX_HEIGHT 42
void BitmapBuffer::drawFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags)
void BitmapBuffer::drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags)
{
coord_t offset = spec[index];
coord_t width = spec[index+1] - offset;
@ -256,6 +284,14 @@ void BitmapBuffer::drawFontPattern(coord_t x, coord_t y, const uint8_t * font, c
lcdNextPos = x + width;
}
void BitmapBuffer::drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags)
{
coord_t offset = spec[index];
coord_t width = spec[index+1] - offset;
drawBitmap(x, y, font, offset, 0, width);
lcdNextPos = x + width;
}
void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags)
{
int width = getTextWidth(s, len, flags);
@ -263,6 +299,7 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
int fontindex = FONTSIZE(flags) >> 8;
const pm_uchar * font = fontsTable[fontindex];
const uint16_t * fontspecs = fontspecsTable[fontindex];
BitmapBuffer * fontcache = NULL;
if (flags & RIGHT)
x -= width;
@ -271,13 +308,36 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
flags = TEXT_INVERTED_COLOR | (flags & 0x0ffff);
if (FONTSIZE(flags) == TINSIZE)
if (fontindex == STDSIZE_INDEX) {
drawSolidFilledRect(x-INVERT_HORZ_MARGIN, y, INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
drawSolidFilledRect(x+width, y, INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
fontcache = fontCache[1];
}
else if (fontindex == TINSIZE_INDEX) {
drawSolidFilledRect(x-INVERT_HORZ_MARGIN+2, y-INVERT_VERT_MARGIN+2, width+2*INVERT_HORZ_MARGIN-5, INVERT_LINE_HEIGHT-7, TEXT_INVERTED_BGCOLOR);
else if (FONTSIZE(flags) == SMLSIZE)
}
else if (fontindex == SMLSIZE_INDEX) {
drawSolidFilledRect(x-INVERT_HORZ_MARGIN, y+1, width+2*INVERT_HORZ_MARGIN-2, INVERT_LINE_HEIGHT-5, TEXT_INVERTED_BGCOLOR);
else
}
else {
drawSolidFilledRect(x-INVERT_HORZ_MARGIN, y, width+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
}
else if (!(flags & NO_FONTCACHE)) {
if (fontindex == STDSIZE_INDEX) {
uint16_t fgColor = lcdColorTable[COLOR_IDX(flags)];
uint16_t bgColor = *getPixelPtr(x, y);
if (fgColor == lcdColorTable[TEXT_COLOR_INDEX] && bgColor == lcdColorTable[TEXT_BGCOLOR_INDEX]) {
fontcache = fontCache[0];
}
else if (fgColor == lcdColorTable[TEXT_INVERTED_COLOR_INDEX] && bgColor == lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX]) {
fontcache = fontCache[1];
}
else {
// TRACE("No cache for \"%s\"", s);
}
}
}
const coord_t orig_x = x;
bool setx = false;
@ -295,7 +355,17 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
break;
}
else if (c >= 0x20) {
drawFontPattern(x, y, font, fontspecs, getMappedChar(c), flags);
#if defined(TRANSLATIONS_FR)
if (c >= 0x80 && c <= 0x85) {
c = 0x20 + 115 + c - 0x80;
}
#endif
if (fontcache) {
drawCharWithCache(x, y, fontcache, fontspecs, getMappedChar(c), flags);
}
else {
drawCharWithoutCache(x, y, font, fontspecs, getMappedChar(c), flags);
}
x = lcdNextPos;
}
else if (c == 0x1F) { // X-coord prefix
@ -391,6 +461,19 @@ BitmapBuffer * BitmapBuffer::load(const char * filename)
return load_stb(filename);
}
BitmapBuffer * BitmapBuffer::loadMask(const char * filename)
{
BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (bitmap) {
display_t * p = bitmap->getData();
for (int i = bitmap->getWidth() * bitmap->getHeight(); i > 0; i--) {
*((uint8_t *)p) = OPACITY_MAX - ((*p) >> 12);
p++;
}
}
return bitmap;
}
FIL imgFile __DMA;
BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)

View file

@ -174,9 +174,15 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
static BitmapBuffer * load(const char * filename);
static BitmapBuffer * loadMask(const char * filename);
void drawMask(coord_t x, coord_t y, BitmapBuffer * mask, LcdFlags flags, coord_t offset=0, coord_t width=0);
void drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset=0, coord_t width=0);
void drawFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags);
void drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags);
void drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags);
void drawText(coord_t x, coord_t y, const char * s, LcdFlags flags)
{

View file

@ -32,18 +32,6 @@ const uint8_t LBM_DOT[] = {
#include "mask_dot.lbm"
};
const uint8_t LBM_CURRENT_BG[] = {
#include "mask_current_bg.lbm"
};
const uint8_t LBM_CURRENT_SHADOW[] = {
#include "mask_current_shadow.lbm"
};
const uint8_t LBM_CURRENT_DOT[] = {
#include "mask_current_dot.lbm"
};
/*
* Main view bitmaps
*/
@ -104,208 +92,10 @@ const uint8_t LBM_RSCALE[] = {
#include "mask_rscale.lbm"
};
/*
* Stats / Debug menu bitmaps
*/
const uint8_t LBM_STATS_ICON[] = {
#include "mask_stats.lbm"
};
const uint8_t LBM_STATS_GRAPH_ICON[] = {
#include "mask_stats_graph.lbm"
};
const uint8_t LBM_STATS_TIME_ICON[] = {
#include "mask_stats_time.lbm"
};
const uint8_t LBM_STATS_DEBUG_ICON[] = {
#include "mask_stats_debug.lbm"
};
const uint8_t LBM_STATS_ANALOGS_ICON[] = {
#include "mask_analogs.lbm"
};
const uint8_t * const LBM_STATS_ICONS[] = {
LBM_STATS_ICON,
LBM_STATS_GRAPH_ICON,
LBM_STATS_TIME_ICON,
LBM_STATS_ANALOGS_ICON,
#if defined(DEBUG_TRACE_BUFFER)
LBM_STATS_DEBUG_ICON
#endif
};
/*
* Radio menu bitmaps
*/
const uint8_t LBM_RADIO_ICON[] = {
#include "mask_menu_radio.lbm"
};
const uint8_t LBM_RADIO_SETUP_ICON[] = {
#include "mask_radio_setup.lbm"
};
const uint8_t LBM_SD_BROWSER_ICON[] = {
#include "mask_sd_browser.lbm"
};
const uint8_t LBM_GLOBAL_FUNCTIONS_ICON[] = {
#include "mask_global_functions.lbm"
};
const uint8_t LBM_TRAINER_ICON[] = {
#include "mask_trainer.lbm"
};
const uint8_t LBM_CALIBRATION_ICON[] = {
#include "mask_calibration.lbm"
};
const uint8_t LBM_VERSION_ICON[] = {
#include "mask_version.lbm"
};
const uint8_t * const LBM_RADIO_ICONS[] = {
LBM_RADIO_ICON,
LBM_RADIO_SETUP_ICON,
LBM_SD_BROWSER_ICON,
LBM_GLOBAL_FUNCTIONS_ICON,
LBM_TRAINER_ICON,
LBM_CALIBRATION_ICON,
LBM_VERSION_ICON
};
/*
* Model menu bitmaps
*/
const uint8_t LBM_MODEL_ICON[] = {
#include "mask_menu_model.lbm"
};
const uint8_t LBM_MODEL_SETUP_ICON[] = {
#include "mask_model_setup.lbm"
};
const uint8_t LBM_HELI_ICON[] = {
#include "mask_heli.lbm"
};
const uint8_t LBM_FLIGHT_MODES_ICON[] = {
#include "mask_flight_modes.lbm"
};
const uint8_t LBM_INPUTS_ICON[] = {
#include "mask_inputs.lbm"
};
const uint8_t LBM_MIXER_ICON[] = {
#include "mask_mixer.lbm"
};
const uint8_t LBM_OUTPUTS_ICON[] = {
#include "mask_outputs.lbm"
};
const uint8_t LBM_CURVES_ICON[] = {
#include "mask_curves.lbm"
};
const uint8_t LBM_GVARS_ICON[] = {
#include "mask_gvars.lbm"
};
const uint8_t LBM_LOGICAL_SWITCHES_ICON[] = {
#include "mask_logical_switches.lbm"
};
const uint8_t LBM_SPECIAL_FUNCTIONS_ICON[] = {
#include "mask_special_functions.lbm"
};
const uint8_t LBM_LUA_SCRIPTS_ICON[] = {
#include "mask_lua_scripts.lbm"
};
const uint8_t LBM_TELEMETRY_ICON[] = {
#include "mask_telemetry.lbm"
};
const uint8_t * const LBM_MODEL_ICONS[] = {
LBM_MODEL_ICON,
LBM_MODEL_SETUP_ICON,
CASE_HELI(LBM_HELI_ICON)
CASE_FLIGHT_MODES(LBM_FLIGHT_MODES_ICON)
LBM_INPUTS_ICON,
LBM_MIXER_ICON,
LBM_OUTPUTS_ICON,
CASE_CURVES(LBM_CURVES_ICON)
CASE_GVARS(LBM_GVARS_ICON)
LBM_LOGICAL_SWITCHES_ICON,
LBM_SPECIAL_FUNCTIONS_ICON,
#if defined(LUA_MODEL_SCRIPTS)
LBM_LUA_SCRIPTS_ICON,
#endif
LBM_TELEMETRY_ICON
};
/*
* UI (theme / layout / widgets bitmaps
*/
const uint8_t LBM_MAINVIEWS_ICON[] = {
#include "mask_mainviews.lbm"
};
const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[] = {
#include "mask_mainviews_topbar.lbm"
};
const uint8_t LBM_MAINVIEWS_1_ICON[] = {
#include "mask_mainviews_1.lbm"
};
const uint8_t LBM_MAINVIEWS_2_ICON[] = {
#include "mask_mainviews_2.lbm"
};
const uint8_t LBM_MAINVIEWS_3_ICON[] = {
#include "mask_mainviews_3.lbm"
};
const uint8_t LBM_MAINVIEWS_4_ICON[] = {
#include "mask_mainviews_4.lbm"
};
const uint8_t LBM_MAINVIEWS_5_ICON[] = {
#include "mask_mainviews_5.lbm"
};
const uint8_t LBM_MAINVIEWS_ADD_ICON[] = {
#include "mask_mainviews_add.lbm"
};
const uint8_t * const LBM_MAINVIEWS_ICONS[] = {
LBM_MAINVIEWS_1_ICON,
LBM_MAINVIEWS_2_ICON,
LBM_MAINVIEWS_3_ICON,
LBM_MAINVIEWS_4_ICON,
LBM_MAINVIEWS_5_ICON
};
/*
* Model selection screen bitmaps
*/
const uint8_t LBM_LIBRARY_ICON[] = {
#include "mask_library.lbm"
};
const uint8_t LBM_LIBRARY_SLOT[] = {
#include "mask_library_slot.lbm"
};

View file

@ -24,9 +24,6 @@
// Header bitmaps
extern const uint8_t LBM_TOPMENU_POLYGON[];
extern const uint8_t LBM_DOT[];
extern const uint8_t LBM_CURRENT_BG[];
extern const uint8_t LBM_CURRENT_SHADOW[];
extern const uint8_t LBM_CURRENT_DOT[];
// Main view icons
extern const uint8_t LBM_TOPMENU_USB[];
@ -40,34 +37,11 @@ extern const uint8_t LBM_TOPMENU_TXBATT[];
extern const uint8_t LBM_HTRIM_FRAME[];
extern const uint8_t LBM_VTRIM_FRAME[];
extern const uint8_t LBM_TRIM_SHADOW[];
extern const uint8_t LBM_RADIO_ICON[];
extern const uint8_t LBM_MODEL_ICON[];
extern const uint8_t LBM_TIMER_BACKGROUND[];
extern const uint8_t LBM_TIMER[];
extern const uint8_t LBM_RSCALE[];
// Menu icons
extern const uint8_t * const LBM_RADIO_ICONS[];
extern const uint8_t * const LBM_MODEL_ICONS[];
extern const uint8_t * const LBM_STATS_ICONS[];
extern const uint8_t LBM_RADIO_ICON[];
extern const uint8_t LBM_SD_BROWSER_ICON[];
extern const uint8_t LBM_CALIBRATION_ICON[];
extern const uint8_t LBM_INPUTS_ICON[];
extern const uint8_t LBM_MIXER_ICON[];
extern const uint8_t LBM_CURVES_ICON[];
extern const uint8_t LBM_LUA_SCRIPTS_ICON[];
extern const uint8_t LBM_TELEMETRY_ICON[];
extern const uint8_t LBM_STATS_ANALOGS_ICON[];
// UI (theme / layout / widgets bitmaps
extern const uint8_t LBM_MAINVIEWS_ICON[];
extern const uint8_t LBM_MAINVIEWS_TOPBAR_ICON[];
extern const uint8_t LBM_MAINVIEWS_ADD_ICON[];
extern const uint8_t * const LBM_MAINVIEWS_ICONS[];
// Model selection icons
extern const uint8_t LBM_LIBRARY_ICON[];
extern const uint8_t LBM_LIBRARY_SLOT[];
extern const uint8_t LBM_ACTIVE_MODEL[];
extern const uint8_t LBM_LIBRARY_CURSOR[];

View file

@ -78,3 +78,23 @@ pm_uchar font_stdsizebold[] = {
const uint16_t * const fontspecsTable[16] = { font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsizebold_specs };
const uint8_t * const fontsTable[16] = { font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsizebold };
BitmapBuffer * fontCache[2];
BitmapBuffer * createFontCache(const uint8_t * font, LcdFlags fg, LcdFlags bg)
{
coord_t width = *((uint16_t *)font);
coord_t height = *(((uint16_t *)font)+1);
BitmapBuffer * buffer = new BitmapBuffer(BMP_RGB565, width, height);
buffer->clear(bg);
buffer->drawBitmapPattern(0, 0, font, fg);
return buffer;
}
void loadFontCache()
{
fontCache[0] = createFontCache(fontsTable[0], TEXT_COLOR, TEXT_BGCOLOR);
fontCache[1] = createFontCache(fontsTable[0], TEXT_INVERTED_COLOR, TEXT_INVERTED_BGCOLOR);
}

View file

@ -59,7 +59,12 @@
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
#define MENU_INIT_VPOS -1
#if defined(HELI) && defined(GVARS) && defined(LUA_MODEL_SCRIPTS)
#define MENU_ICONS_SPACING 31
#else
#define MENU_ICONS_SPACING 33
#endif
#define SUBMENU_LINE_WIDTH 230
#define LOAD_MODEL_BITMAP()

View file

@ -62,20 +62,31 @@
/* telemetry flags */
#define NO_UNIT 0x40
#define FONTSIZE(x) ((x) & 0x0700)
#define TINSIZE 0x0100
#define SMLSIZE 0x0200
#define MIDSIZE 0x0300
#define DBLSIZE 0x0400
#define XXLSIZE 0x0500
#define BOLD 0x0600
#define VERTICAL 0x0800
enum FontSizeIndex {
STDSIZE_INDEX,
TINSIZE_INDEX,
SMLSIZE_INDEX,
MIDSIZE_INDEX,
DBLSIZE_INDEX,
XXLSIZE_INDEX,
BOLDSTDSIZE_INDEX,
};
#define FONTSIZE(x) ((x) & 0x0700)
#define TINSIZE (TINSIZE_INDEX << 8)
#define SMLSIZE (SMLSIZE_INDEX << 8)
#define MIDSIZE (MIDSIZE_INDEX << 8)
#define DBLSIZE (DBLSIZE_INDEX << 8)
#define XXLSIZE (XXLSIZE_INDEX << 8)
#define BOLD (BOLDSTDSIZE_INDEX << 8)
#define VERTICAL 0x0800
#define TIMEBLINK 0x1000
#define TIMEHOUR 0x2000
#define STREXPANDED 0x4000
#define NO_FONTCACHE 0x8000
#include "colors.h"
#define DISPLAY_PIXELS_COUNT (LCD_W*LCD_H)
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_PIXELS_COUNT)

View file

@ -18,10 +18,10 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
bool menuGeneralCustomFunctions(evt_t event)
{
MENU(STR_MENUGLOBALFUNCS, LBM_RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
MENU(STR_MENUGLOBALFUNCS, RADIO_ICONS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
}

View file

@ -65,7 +65,7 @@ void drawPots()
bool menuCommonCalib(evt_t event)
{
drawScreenTemplate(NULL, LBM_CALIBRATION_ICON, OPTION_MENU_NO_FOOTER);
drawMenuTemplate(NULL, ICON_RADIO_CALIBRATION, NULL, OPTION_MENU_NO_FOOTER);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i);

View file

@ -18,7 +18,7 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
enum menuGeneralHwItems {
ITEM_SETUP_HW_CALIBRATION,
@ -58,7 +58,7 @@ enum menuGeneralHwItems {
bool menuGeneralHardware(evt_t event)
{
MENU(STR_HARDWARE, LBM_RADIO_ICONS, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
uint8_t sub = menuVerticalPosition;

View file

@ -31,7 +31,7 @@ BitmapBuffer * currentBitmap = NULL;
bool menuGeneralSdManagerInfo(evt_t event)
{
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, LBM_SD_BROWSER_ICON, 1);
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, ICON_RADIO_SD_BROWSER, 1);
lcdDrawText(MENUS_MARGIN_LEFT, 2*FH, STR_SD_TYPE);
lcdDrawText(100, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
@ -170,7 +170,7 @@ bool menuGeneralSdManager(evt_t _event)
}
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, LBM_RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, RADIO_ICONS, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
int index = menuVerticalPosition-menuVerticalOffset;

View file

@ -73,12 +73,14 @@ enum menuGeneralSetupItems {
ITEM_SETUP_INACTIVITY_ALARM,
// ITEM_SETUP_MEMORY_WARNING,
ITEM_SETUP_ALARM_WARNING,
// ITEM_SETUP_BACKLIGHT_LABEL,
// ITEM_SETUP_BACKLIGHT_MODE,
// ITEM_SETUP_BACKLIGHT_DELAY,
// ITEM_SETUP_BRIGHTNESS,
// ITEM_SETUP_FLASH_BEEP,
ITEM_SETUP_BACKLIGHT_LABEL,
ITEM_SETUP_BACKLIGHT_MODE,
ITEM_SETUP_BACKLIGHT_DELAY,
ITEM_SETUP_BRIGHTNESS,
ITEM_SETUP_DIM_LEVEL,
ITEM_SETUP_FLASH_BEEP,
// CASE_SPLASH_PARAM(ITEM_SETUP_DISABLE_SPLASH)
CASE_GPS(ITEM_SETUP_LABEL_GPS)
CASE_GPS(ITEM_SETUP_TIMEZONE)
CASE_GPS(ITEM_SETUP_GPSFORMAT)
CASE_PXX(ITEM_SETUP_COUNTRYCODE)
@ -114,12 +116,14 @@ bool menuGeneralSetup(evt_t event)
}
#endif
MENU(STR_MENURADIOSETUP, LBM_RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, {
MENU(STR_MENURADIOSETUP, RADIO_ICONS, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, {
2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, 1|NAVIGATION_LINE_BY_LINE,
LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0,
CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0)
CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0)
LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, 0, 0, 0, 0, 1/*to force edit mode*/ });
LABEL(ALARMS), 0, 0, 0,
LABEL(BACKLIGHT), 0, 0, 0, 0, 0,
CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, 0, 0, 0, 0, 1/*to force edit mode*/ });
int sub = menuVerticalPosition;
@ -372,7 +376,6 @@ bool menuGeneralSetup(evt_t event)
if (attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
break;
#if 0
case ITEM_SETUP_BACKLIGHT_LABEL:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BACKLIGHT_LABEL);
break;
@ -394,21 +397,20 @@ bool menuGeneralSetup(evt_t event)
break;
case ITEM_SETUP_BRIGHTNESS:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BRIGHTNESS);
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLONBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
if (attr) {
uint8_t b = 100 - g_eeGeneral.backlightBright;
CHECK_INCDEC_GENVAR(event, b, 0, 100);
CHECK_INCDEC_GENVAR(event, b, 5, 100);
g_eeGeneral.backlightBright = 100 - b;
}
break;
case ITEM_SETUP_BACKLIGHT_COLOR:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLCOLOR);
drawSlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr);
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS);
case ITEM_SETUP_DIM_LEVEL:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLOFFBRIGHTNESS);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT) ;
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 5, 100);
break;
#endif
#if 0
case ITEM_SETUP_DISABLE_SPLASH:
@ -425,6 +427,10 @@ bool menuGeneralSetup(evt_t event)
}
#endif
case ITEM_SETUP_LABEL_GPS:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_GPS);
break;
case ITEM_SETUP_TIMEZONE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TIMEZONE);
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);

View file

@ -30,7 +30,7 @@ bool menuGeneralTrainer(evt_t event)
uint8_t y;
bool slave = SLAVE_MODE();
MENU(STR_MENUTRAINER, LBM_RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, e_Trainer, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);

View file

@ -22,18 +22,25 @@
bool menuGeneralVersion(evt_t event)
{
SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0);
DEBUG_TIMER_START(debugTimerVersion);
DEBUG_TIMER_START(debugTimerSimpleMenu);
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, e_Vers, 0);
DEBUG_TIMER_STOP(debugTimerSimpleMenu);
DEBUG_TIMER_START(debugTimerDrawText);
DEBUG_TIMER_START(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText);
// TODO EEPROM erase + backup
// lcd_putsCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
// backupEeprom();
// }
DEBUG_TIMER_STOP(debugTimerVersion);
return true;
}

View file

@ -139,7 +139,7 @@ bool menuModelCurveOne(evt_t event)
CurveData & crv = g_model.curves[s_curveChan];
int8_t * points = curveAddress(s_curveChan);
SUBMENU_WITH_OPTIONS(STR_MENUCURVE, LBM_CURVES_ICON, crv.type==CURVE_TYPE_CUSTOM ? 6 : 5, OPTION_MENU_NO_FOOTER, { 0, 0, 0, 0, uint8_t(5+crv.points-1), uint8_t(5+crv.points-1) });
SUBMENU_WITH_OPTIONS(STR_MENUCURVE, ICON_MODEL_CURVES, crv.type==CURVE_TYPE_CUSTOM ? 6 : 5, OPTION_MENU_NO_FOOTER, { 0, 0, 0, 0, uint8_t(5+crv.points-1), uint8_t(5+crv.points-1) });
drawStringWithIndex(50, 3+FH, STR_CV, s_curveChan+1, MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 250, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@ -335,7 +335,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
bool menuModelCurvesAll(evt_t event)
{
SIMPLE_MENU(STR_MENUCURVES, LBM_MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES);
SIMPLE_MENU(STR_MENUCURVES, MODEL_ICONS, menuTabModel, e_CurvesAll, MAX_CURVES);
int8_t sub = menuVerticalPosition;

View file

@ -30,7 +30,18 @@
void onCustomFunctionsFileSelectionMenu(const char * result)
{
int sub = menuVerticalPosition;
CustomFunctionData * cf = &g_model.customFn[sub];
CustomFunctionData * cf;
uint8_t eeFlags;
if (menuHandlers[menuLevel] == menuModelCustomFunctions) {
cf = &g_model.customFn[sub];
eeFlags = EE_MODEL;
}
else {
cf = &g_eeGeneral.customFn[sub];
eeFlags = EE_GENERAL;
}
uint8_t func = CFN_FUNC(cf);
if (result == STR_UPDATE_LIST) {
@ -95,6 +106,35 @@ void onCustomFunctionsMenu(const char *result)
}
}
void onAdjustGvarSourceLongEnterPress(const char * result)
{
CustomFunctionData * cfn = &g_model.customFn[menuVerticalPosition];
if (result == STR_CONSTANT) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
CFN_PARAM(cfn) = 0;
storageDirty(EE_MODEL);
}
else if (result == STR_MIXSOURCE) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
CFN_PARAM(cfn) = 0;
storageDirty(EE_MODEL);
}
else if (result == STR_GLOBALVAR) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
CFN_PARAM(cfn) = 0;
storageDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INCDEC;
CFN_PARAM(cfn) = 0;
storageDirty(EE_MODEL);
}
else {
onSourceLongEnterPress(result);
}
}
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
{
uint32_t sub = menuVerticalPosition;
@ -134,7 +174,9 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
LcdFlags active = (attr && s_editMode>0);
switch (j) {
case 0:
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
if (active || AUTOSWITCH_ENTER_LONG()) {
CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
}
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext.activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
break;
@ -254,7 +296,10 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
else if (func == FUNC_PLAY_VALUE) {
val_max = MIXSRC_LAST_TELEM;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
INCDEC_ENABLE_CHECK(isSourceAvailable);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(functions == g_eeGeneral.customFn ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
}
}
#endif
else if (func == FUNC_VOLUME) {
@ -290,26 +335,22 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
break;
case FUNC_ADJUST_GVAR_GVAR:
val_max = MAX_GVARS-1;
drawStringWithIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
val_max = 1;
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
break;
}
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
s_editMode = !s_editMode;
active = true;
CFN_GVAR_MODE(cfn) += 1;
CFN_GVAR_MODE(cfn) &= 0x03;
val_displayed = 0;
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcdDrawText(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-= ", attr);
else
lcdDrawText(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+= ", attr);
lcdDrawNumber(lcdNextPos, y, abs(val_displayed), attr|LEFT);
}
}
#endif
@ -317,8 +358,21 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
REPEAT_LAST_CURSOR_MOVE(0);
}
if (active) {
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
if (func == FUNC_ADJUST_GVAR && attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
POPUP_MENU_ADD_ITEM(STR_CONSTANT);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
POPUP_MENU_ADD_ITEM(STR_MIXSOURCE);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
POPUP_MENU_ADD_ITEM(STR_GLOBALVAR);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INCDEC)
POPUP_MENU_ADD_ITEM(STR_INCDEC);
popupMenuHandler = onAdjustGvarSourceLongEnterPress;
s_editMode = EDIT_MODIFY_FIELD;
}
}
break;
}
@ -353,6 +407,6 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
bool menuModelCustomFunctions(evt_t event)
{
MENU(STR_MENUCUSTOMFUNC, LBM_MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
MENU(STR_MENUCUSTOMFUNC, MODEL_ICONS, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
}

View file

@ -53,7 +53,7 @@ bool menuModelCustomScriptOne(evt_t event)
// drawStringWithIndex(lcdLastPos+FW, 0, "LUA", s_currIdx+1, 0);
SUBMENU(STR_MENUCUSTOMSCRIPTS, LBM_LUA_SCRIPTS_ICON, 3+scriptInputsOutputs[s_currIdx].inputsCount, { 0, 0, LABEL(inputs), 0/*repeated*/ });
SUBMENU(STR_MENUCUSTOMSCRIPTS, ICON_MODEL_LUA_SCRIPTS, 3+scriptInputsOutputs[s_currIdx].inputsCount, { 0, 0, LABEL(inputs), 0/*repeated*/ });
int8_t sub = menuVerticalPosition;
@ -127,7 +127,7 @@ bool menuModelCustomScripts(evt_t event)
// lcdDrawNumber(19*FW, 0, luaGetMemUsed(), 0);
// lcdDrawText(19*FW+1, 0, STR_BYTES);
MENU(STR_MENUCUSTOMSCRIPTS, LBM_MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
MENU(STR_MENUCUSTOMSCRIPTS, MODEL_ICONS, menuTabModel, e_CustomScripts, MAX_SCRIPTS, { NAVIGATION_LINE_BY_LINE|3/*repeated*/ });
int8_t sub = menuVerticalPosition;

View file

@ -80,7 +80,7 @@ bool isTrimModeAvailable(int mode)
bool menuModelFlightModesAll(evt_t event)
{
MENU(STR_MENUFLIGHTPHASES, LBM_MODEL_ICONS, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
MENU(STR_MENUFLIGHTPHASES, MODEL_ICONS, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
int sub = menuVerticalPosition;

View file

@ -44,7 +44,7 @@ void onGVARSMenu(const char *result)
bool menuModelGVars(evt_t event)
{
MENU(STR_MENUGLOBALVARS, LBM_MODEL_ICONS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
MENU(STR_MENUGLOBALVARS, MODEL_ICONS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
int sub = menuVerticalPosition;

View file

@ -36,7 +36,7 @@ enum menuModelHeliItems {
bool menuModelHeli(evt_t event)
{
SIMPLE_MENU(STR_MENUHELISETUP, LBM_MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX);
SIMPLE_MENU(STR_MENUHELISETUP, MODEL_ICONS, menuTabModel, e_Heli, ITEM_HELI_MAX);
int sub = menuVerticalPosition;

View file

@ -175,7 +175,7 @@ bool menuModelExpoOne(evt_t event)
{
ExpoData * ed = expoAddress(s_currIdx);
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, LBM_INPUTS_ICON, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@ -233,7 +233,7 @@ bool menuModelExpoOne(evt_t event)
case EXPO_FIELD_SOURCE:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE));
putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|(menuHorizontalPosition==0?attr:0));
putsMixerSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, menuHorizontalPosition==0 ? attr : 0);
if (attr && menuHorizontalPosition==0) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
if (ed->srcRaw >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannelValue(EXPO_ONE_2ND_COLUMN+60, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|(menuHorizontalPosition==1?attr:0));
@ -370,7 +370,7 @@ bool menuModelExposAll(evt_t event)
uint8_t chn = expoAddress(s_currIdx)->chn + 1;
int linesCount = getExposLinesCount();
SIMPLE_MENU(STR_MENUINPUTS, LBM_MODEL_ICONS, menuTabModel, e_InputsAll, linesCount);
SIMPLE_MENU(STR_MENUINPUTS, MODEL_ICONS, menuTabModel, e_InputsAll, linesCount);
switch (event) {
case EVT_ENTRY:

View file

@ -93,7 +93,7 @@ void onLimitsMenu(const char *result)
bool menuModelLimits(evt_t event)
{
MENU(STR_MENULIMITS, LBM_MODEL_ICONS, menuTabModel, e_Limits, NUM_CHNOUT+1,
MENU(STR_MENULIMITS, MODEL_ICONS, menuTabModel, e_Limits, NUM_CHNOUT+1,
{ NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,

View file

@ -77,7 +77,7 @@ bool menuModelLogicalSwitches(evt_t event)
{
INCDEC_DECLARE_VARS(EE_MODEL);
MENU(STR_MENULOGICALSWITCHES, LBM_MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
MENU(STR_MENULOGICALSWITCHES, MODEL_ICONS, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH, { NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/} );
int k = 0;
int sub = menuVerticalPosition;

View file

@ -174,7 +174,7 @@ bool menuModelMixOne(evt_t event)
{
MixData * md2 = mixAddress(s_currIdx) ;
SUBMENU_WITH_OPTIONS(STR_MIXER, LBM_MIXER_ICON, MIX_FIELD_COUNT, OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, 0, 0, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/ });
SUBMENU_WITH_OPTIONS(STR_MIXER, ICON_MODEL_MIXER, MIX_FIELD_COUNT, OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, 0, 0, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/ });
putsChn(50, 3+FH, md2->destCh+1, MENU_TITLE_COLOR);
// The separation line between 2 columns
@ -201,7 +201,7 @@ bool menuModelMixOne(evt_t event)
break;
case MIX_FIELD_SOURCE:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE));
putsMixerSource(MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr);
putsMixerSource(MIXES_2ND_COLUMN, y, md2->srcRaw, attr);
if (attr) CHECK_INCDEC_MODELSOURCE(event, md2->srcRaw, 1, MIXSRC_LAST);
break;
case MIX_FIELD_WEIGHT:
@ -341,7 +341,7 @@ bool menuModelMixAll(evt_t event)
uint8_t chn = mixAddress(s_currIdx)->destCh + 1;
int linesCount = getMixesLinesCount();
SIMPLE_MENU(STR_MIXER, LBM_MODEL_ICONS, menuTabModel, e_MixAll, linesCount);
SIMPLE_MENU(STR_MIXER, MODEL_ICONS, menuTabModel, e_MixAll, linesCount);
switch (event) {
case EVT_ENTRY:

View file

@ -218,7 +218,7 @@ bool menuModelSelect(evt_t event)
}
// Header
theme->drawTopbarBackground(LBM_LIBRARY_ICON);
theme->drawTopbarBackground(ICON_LIBRARY);
// Body
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR);

Some files were not shown because too many files have changed in this diff Show more