Skip to content

Commit

Permalink
Merge branch 'main' into wmibus
Browse files Browse the repository at this point in the history
  • Loading branch information
wimalopaan committed Jan 21, 2022
2 parents 2107a00 + 890ef36 commit dac0f55
Show file tree
Hide file tree
Showing 36 changed files with 885 additions and 441 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/win-cpn-32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,18 @@ jobs:
mingw-w64-i686-clang \
mingw-w64-i686-nsis
pip install Pillow clang
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ../Qt
key: win32-QtCache

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
arch: ${{ env.MINGW_VERSION }}

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/win_cpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ jobs:
mingw-w64-x86_64-clang \
mingw-w64-x86_64-nsis
pip install Pillow clang
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ../Qt
key: win64-QtCache

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
arch: ${{ env.MINGW_VERSION }}

Expand Down
55 changes: 0 additions & 55 deletions radio/src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,56 +1057,6 @@ void printInterrupts()
}
#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);
}
}
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];
if (!tsl) {
serialPrint("Not enough memory");
return;
}
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)
{
Expand Down Expand Up @@ -1277,11 +1227,6 @@ int cliDisplay(const char ** argv)
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();
Expand Down
26 changes: 0 additions & 26 deletions radio/src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,32 +177,6 @@ void dumpTraceBuffer()
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()
Expand Down
19 changes: 0 additions & 19 deletions radio/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,25 +322,6 @@ extern struct InterruptCounters interruptCounters;

#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)
Expand Down
95 changes: 86 additions & 9 deletions radio/src/gui/128x64/radio_diaganas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@
*/

#include "opentx.h"
#include "../../hal/adc_driver.h"

#define HOLDANAVALUEFRAMES 4 /* 4* 50ms = 200 ms update rate */

void menuRadioDiagAnalogs(event_t event)
{
static int8_t entryCount = 0;
static uint16_t lastShownAnalogValue[NUM_STICKS+NUM_POTS+NUM_SLIDERS];

enum ANAVIEWS{
ANAVIEW_FIRST,
ANAVIEW_CALIB=ANAVIEW_FIRST,
ANAVIEW_RAWLOWFPS,
ANAVIEW_LAST=ANAVIEW_RAWLOWFPS
};

static int viewpage = ANAVIEW_FIRST;

// TODO enum
#if defined(TX_CAPACITY_MEASUREMENT)
#define ANAS_ITEMS_COUNT 3
Expand All @@ -32,25 +47,87 @@ void menuRadioDiagAnalogs(event_t event)
#define ANAS_ITEMS_COUNT 1
#endif

SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS, HEADER_LINE+ANAS_ITEMS_COUNT);
switch (event) {
case EVT_KEY_FIRST(KEY_UP):
#if defined(KEYS_GPIO_REG_PAGEDN)
case EVT_KEY_BREAK(KEY_PAGEDN):
#elif defined(NAVIGATION_X7)
case EVT_KEY_BREAK(KEY_PAGE):
#endif
{
if (viewpage == ANAVIEW_LAST)
viewpage = ANAVIEW_FIRST;
else
viewpage++;
if (viewpage == ANAVIEW_RAWLOWFPS) entryCount = 0;
break;
}

case EVT_KEY_FIRST(KEY_DOWN):
#if defined(KEYS_GPIO_REG_PAGEUP)
case EVT_KEY_BREAK(KEY_PAGEUP):
#elif defined(NAVIGATION_X7)
case EVT_KEY_LONG(KEY_PAGE):
#endif
{
if (viewpage == ANAVIEW_FIRST)
viewpage = ANAVIEW_LAST;
else
viewpage--;
if (viewpage == ANAVIEW_RAWLOWFPS) entryCount = 0;
break;
}
}

switch (viewpage) {
case (ANAVIEW_CALIB):
SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_CALIB,
HEADER_LINE+ANAS_ITEMS_COUNT);
break;
case (ANAVIEW_RAWLOWFPS):
SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_RAWLOWFPS,
HEADER_LINE+ANAS_ITEMS_COUNT);
break;
}

coord_t y = MENU_HEADER_HEIGHT + 1;

lcdDrawTextAlignedLeft(y, STICKS_PWM_ENABLED() ? STR_PWM_STICKS_POTS_SLIDERS : STR_STICKS_POTS_SLIDERS);
lcdDrawTextAlignedLeft(y, STICKS_PWM_ENABLED() ? STR_PWM_STICKS_POTS_SLIDERS
: STR_STICKS_POTS_SLIDERS);

for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
uint8_t x;
if (i & 1) {
x = LCD_W/2 + INDENT_WIDTH;
}
else {
x = LCD_W / 2 + INDENT_WIDTH;
} else {
x = INDENT_WIDTH;
y += FH;
}
drawStringWithIndex(x, y, "A", i+1);
drawStringWithIndex(x, y, "A", i + 1);
lcdDrawChar(lcdNextPos, y, ':');
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));
lcdDrawNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256, RIGHT);
switch (viewpage) {
case (ANAVIEW_RAWLOWFPS):
if (entryCount == 0) {
lastShownAnalogValue[i] = getAnalogValue(i); // Update value
}
lcdDrawNumber(x+3*FW-1, y, lastShownAnalogValue[i],
LEADING0|LEFT, 4);
break;
case (ANAVIEW_CALIB):
default:
lcdDrawNumber(x+3*FW-1, y, anaIn(i), LEADING0|LEFT, 4);
break;
}
lcdDrawNumber(x+10*FW-1, y,
(int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256,
RIGHT);
}

if (viewpage == ANAVIEW_RAWLOWFPS) {
if (entryCount > HOLDANAVALUEFRAMES)
entryCount = 0;
else
entryCount++;
}

#if defined(GYRO)
Expand Down
53 changes: 51 additions & 2 deletions radio/src/gui/212x64/radio_diaganas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,58 @@
*/

#include "opentx.h"
#include "../../hal/adc_driver.h"

#define HOLDANAVALUEFRAMES 4 /* 4* 50ms = 200 ms update rate */

void menuRadioDiagAnalogs(event_t event)
{
SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS, 0);
static int8_t entryCount = 0;
static uint16_t lastShownAnalogValue[NUM_STICKS+NUM_POTS+NUM_SLIDERS];

enum ANAVIEWS{
ANAVIEW_FIRST,
ANAVIEW_CALIB=ANAVIEW_FIRST,
ANAVIEW_RAWLOWFPS,
ANAVIEW_LAST=ANAVIEW_RAWLOWFPS
};

static int viewpage = ANAVIEW_FIRST;

if (event == EVT_KEY_BREAK(KEY_PAGE)) {
if (viewpage == ANAVIEW_LAST)
viewpage = ANAVIEW_FIRST;
else
viewpage++;
if (viewpage == ANAVIEW_RAWLOWFPS)
entryCount = 0;
}

switch (viewpage)
{
case (ANAVIEW_CALIB): SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_CALIB, 0); break;
case (ANAVIEW_RAWLOWFPS): SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_RAWLOWFPS, 0); break;
}

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;
lcdDrawNumber(x, y, i+1, LEADING0|LEFT, 2);
lcdDrawChar(x+2*FW-2, y, ':');
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));

switch (viewpage)
{
case (ANAVIEW_RAWLOWFPS):
if (entryCount == 0)
{
lastShownAnalogValue[i] = getAnalogValue(i); // Update value
}
lcdDrawNumber(x+3*FW-1, y, lastShownAnalogValue[i], LEADING0|LEFT, 4);
break;
case (ANAVIEW_CALIB):
default:
lcdDrawNumber(x+3*FW-1, y, anaIn(i), LEADING0|LEFT, 4); break;
}
#if defined(JITTER_MEASURE)
lcdDrawNumber(x+10*FW-1, y, rawJitter[i].get(), RIGHT);
lcdDrawNumber(x+13*FW-1, y, avgJitter[i].get(), RIGHT);
Expand All @@ -39,4 +80,12 @@ void menuRadioDiagAnalogs(event_t event)
lcdDrawNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256, RIGHT);
#endif
}

if (viewpage == ANAVIEW_RAWLOWFPS)
{
if (entryCount > HOLDANAVALUEFRAMES)
entryCount = 0;
else
entryCount++;
}
}
Loading

0 comments on commit dac0f55

Please sign in to comment.