Skip to content

Commit

Permalink
Merge branch 'main' into 3djc/frsky-receiver-update
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc authored Sep 25, 2023
2 parents 1d6703a + 1cc1810 commit da9c463
Show file tree
Hide file tree
Showing 176 changed files with 4,150 additions and 4,265 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- t16
- t18
- t8;zorro;pocket;commando8
- tlite;tlitef4;tpro;tprov2;lr3pro
- tlite;tpro;tprov2;lr3pro
- t20
- tx12;tx12mk2;boxer
- tx16s
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- t16
- t18
- t8;zorro;pocket;commando8
- tlite;tlitef4;tpro;tprov2;lr3pro
- tlite;tpro;tprov2;lr3pro
- t20
- tx12;tx12mk2;boxer
- tx16s
Expand Down
17 changes: 0 additions & 17 deletions companion/src/firmwares/customisation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,6 @@ bool RadioLayout::CustomScreenData::isEmpty() const
return strlen(layoutId) == 0;
}

void RadioTheme::init(const char* themeName, ThemeData& themeData)
{
memset(&themeData, 0, sizeof(ThemeData));

memcpy(&themeData.themeName, themeName, THEME_NAME_LEN);

PersistentData& persistentData = themeData.themePersistentData;

persistentData.options[0].type =
zoneValueEnumFromType(ZoneOption::Type::Color);
setZoneOptionValue(persistentData.options[0].value, (unsigned int)WHITE);

persistentData.options[1].type =
zoneValueEnumFromType(ZoneOption::Type::Color);
setZoneOptionValue(persistentData.options[1].value, (unsigned int)RED);
}

void RadioLayout::init(const char* layoutId, CustomScreens& customScreens)
{
memset(&customScreens, 0, sizeof(CustomScreens));
Expand Down
18 changes: 0 additions & 18 deletions companion/src/firmwares/customisation_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/

constexpr int MAX_CUSTOM_SCREENS {10};
constexpr int THEME_NAME_LEN {8};
constexpr int MAX_THEME_OPTIONS {5};
constexpr int LEN_ZONE_OPTION_STRING {8};
constexpr int MAX_LAYOUT_ZONES {10};
Expand Down Expand Up @@ -146,23 +145,6 @@ typedef WidgetsContainerPersistentData<MAX_LAYOUT_ZONES, MAX_LAYOUT_OPTIONS>
typedef WidgetsContainerPersistentData<MAX_TOPBAR_ZONES, MAX_TOPBAR_OPTIONS>
TopBarPersistentData;

class RadioTheme
{
Q_DECLARE_TR_FUNCTIONS(RadioTheme)

public:
struct PersistentData {
ZoneOptionValueTyped options[MAX_THEME_OPTIONS];
};

struct ThemeData {
char themeName[THEME_NAME_LEN + 1];
PersistentData themePersistentData;
};

static void init(const char * themeName, ThemeData & themeData);
};

class RadioLayout
{
Q_DECLARE_TR_FUNCTIONS(RadioLayout)
Expand Down
6 changes: 0 additions & 6 deletions companion/src/firmwares/edgetx/yaml_generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["potsConfig"] = potsConfig;
}

// Color lcd theme settings are not used in EdgeTx
// RadioTheme::ThemeData themeData;

node["ownerRegistrationID"] = rhs.registrationId;

// Gyro (for now only xlites)
Expand Down Expand Up @@ -573,9 +570,6 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
}
}

// Color lcd theme settings are not used in EdgeTx
// RadioTheme::ThemeData themeData;

node["ownerRegistrationID"] >> rhs.registrationId;

// Gyro (for now only xlites)
Expand Down
2 changes: 0 additions & 2 deletions companion/src/firmwares/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ class GeneralSettings {
char sliderName[CPN_MAX_SLIDERS][HARDWARE_NAME_LEN + 1];
unsigned int sliderConfig[CPN_MAX_SLIDERS];

RadioTheme::ThemeData themeData;

char registrationId[REGISTRATION_ID_LEN + 1];
int gyroMax;
int gyroOffset;
Expand Down
16 changes: 0 additions & 16 deletions companion/src/firmwares/opentx/opentxeeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3304,15 +3304,6 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
}

if (IS_FAMILY_HORUS_OR_T16(board)) {
if (version >= 220) { // data from earlier versions cannot be converted so fields initialised in afterImport
internalField.Append(new CharField<8>(this, generalData.themeData.themeName, true, "Theme name"));
for (int i = 0; i < MAX_THEME_OPTIONS; i++) {
internalField.Append(new ZoneOptionValueTypedField(this, generalData.themeData.themePersistentData.options[i], board, version));
}
}
}

if (version >= 220) {
internalField.Append(new CharField<8>(this, generalData.registrationId, "ACCESS Registration ID"));
}
Expand Down Expand Up @@ -3357,13 +3348,6 @@ void OpenTxGeneralData::beforeExport()

void OpenTxGeneralData::afterImport()
{
if (IS_FAMILY_HORUS_OR_T16(board)) {
if (version < 220) { // re-initialise as no conversion possible
const char * themeName = IS_FLYSKY_NV14(board) ? "FlySky" : "EdgeTX";
RadioTheme::init(themeName, generalData.themeData);
}
}

if (Boards::getCapability((Board::Type)generalData.variant,
Board::SportMaxBaudRate) >= 400000)
generalData.internalModuleBaudrate =
Expand Down
7 changes: 0 additions & 7 deletions companion/src/modeledit/colorcustomscreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware)
{
RadioTheme::ThemeData & td = generalSettings.themeData;

QString sdPath = QString(g.profile[g.id()].sdPath()).trimmed();

grid = new QGridLayout(this);
Expand Down Expand Up @@ -191,11 +189,6 @@ UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, Gene

col = 0;

if (SHOW_RAW_INFO) {
addGridLabel(grid, tr("Theme"), row, col++);
grid->addLayout(addOptionsLayout<RadioTheme::PersistentData>(td.themePersistentData, MAX_THEME_OPTIONS), row, col);
}

// the grid must be fully built for the rowspan to work as required
foreach (QWidget * wgt, optswidgets) {
grid->addWidget(wgt, widgetdetailsrow, widgetdetailscol, 3, Qt::AlignTop);
Expand Down
1 change: 0 additions & 1 deletion fw.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
["Jumper T16", "t16-"],
["Jumper T18", "t18-"],
["Jumper T-Lite", "tlite-"],
["Jumper T-Lite (F4 MCU)", "tlitef4-"],
["Jumper T-Pro", "tpro-"],
["Jumper T-Pro V2", "tprov2-"],
["Jumper T20", "t20-"],
Expand Down
10 changes: 2 additions & 8 deletions radio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ set(GVARS_VARIANT 1)
set(FRSKY_VARIANT 2)
set(3POS_VARIANT 4)

set(FATFS_SRC
${FATFS_DIR}/ff.c
${FATFS_DIR}/ffunicode.c
${FATFS_DIR}/fattime.c
)

if(PCB STREQUAL X12S OR PCB STREQUAL X10)
include(targets/horus/CMakeLists.txt)
elseif(PCB STREQUAL NV14)
Expand Down Expand Up @@ -252,9 +246,8 @@ endif()

if(SDCARD)
add_definitions(-DSDCARD)
include_directories(${FATFS_DIR} ${FATFS_DIR}/option)
set(SRC ${SRC} sdcard.cpp rtc.cpp logs.cpp thirdparty/libopenui/src/libopenui_file.cpp)
set(FIRMWARE_SRC ${FIRMWARE_SRC} ${FATFS_SRC})
set(FIRMWARE_SRC ${FIRMWARE_SRC})
endif()

if(SHUTDOWN_CONFIRMATION)
Expand Down Expand Up @@ -395,6 +388,7 @@ set(SRC
strhelpers.cpp
switches.cpp
analogs.cpp
mixes.cpp
mixer.cpp
mixer_scheduler.cpp
stamp.cpp
Expand Down
2 changes: 1 addition & 1 deletion radio/src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ int WavContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade)
}
#endif

const unsigned int toneVolumes[] = { 10, 8, 6, 4, 2 };
const uint8_t toneVolumes[] = { 10, 8, 6, 4, 2 };
inline float evalVolumeRatio(int freq, int volume)
{
float result = toneVolumes[2+volume];
Expand Down
2 changes: 1 addition & 1 deletion radio/src/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void Bluetooth::wakeup()
} else if (state == BLUETOOTH_STATE_NAME_SENT && (line != nullptr) &&
(!strncmp(line, "OK+", 3) || !strncmp(line, "Central:", 8) ||
!strncmp(line, "Peripheral:", 11))) {
writeString("AT+TXPW0");
writeString("AT+TXPW2");
state = BLUETOOTH_STATE_POWER_SENT;
} else if (state == BLUETOOTH_STATE_POWER_SENT &&
(line != nullptr) &&
Expand Down
18 changes: 11 additions & 7 deletions radio/src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <FreeRTOS/include/stream_buffer.h>

#include "opentx.h"
#include "diskio.h"
#include "timers_driver.h"
#include "watchdog_driver.h"

Expand All @@ -33,6 +32,8 @@

#include "hal/adc_driver.h"
#include "hal/module_port.h"
#include "hal/fatfs_diskio.h"
#include "hal/storage.h"

#include "tasks.h"
#include "tasks/mixer_task.h"
Expand Down Expand Up @@ -347,8 +348,9 @@ int cliReadSD(const char ** argv)
uint32_t bytesRead = numberOfSectors * 512;
tmr10ms_t start = get_tmr10ms();

auto drv = storageGetDefaultDriver();
while (numberOfSectors > 0) {
DRESULT res = __disk_read(0, buffer, startSector, bufferSectors);
DRESULT res = drv->read(0, buffer, startSector, bufferSectors);
if (res != RES_OK) {
cliSerialPrint("disk_read error: %d, sector: %d(%d)", res, startSector, numberOfSectors);
}
Expand Down Expand Up @@ -385,10 +387,11 @@ int cliReadSD(const char ** argv)
int cliTestSD(const char ** argv)
{
// Do the read test on the SD card and report back the result
auto drv = storageGetDefaultDriver();

// get sector count
uint32_t sectorCount;
if (disk_ioctl(0, GET_SECTOR_COUNT, &sectorCount) != RES_OK) {
if (drv->ioctl(0, GET_SECTOR_COUNT, &sectorCount) != RES_OK) {
cliSerialPrint("Error: can't read sector count");
return 0;
}
Expand All @@ -401,8 +404,9 @@ int cliTestSD(const char ** argv)
cliSerialPrint("Not enough memory");
return 0;
}

for (uint32_t s = sectorCount - 16; s<sectorCount; ++s) {
DRESULT res = __disk_read(0, buffer, s, 1);
DRESULT res = drv->read(0, buffer, s, 1);
if (res != RES_OK) {
cliSerialPrint("sector %d read FAILED, err: %d", s, res);
}
Expand All @@ -421,8 +425,8 @@ int cliTestSD(const char ** argv)
}

cliSerialPrint("Starting multiple sector read test, reading two sectors at the time");
for (uint32_t s = sectorCount - 16; s<sectorCount; s+=2) {
DRESULT res = __disk_read(0, buffer, s, 2);
for (uint32_t s = sectorCount - 16; s < sectorCount; s += 2) {
DRESULT res = drv->read(0, buffer, s, 2);
if (res != RES_OK) {
cliSerialPrint("sector %d-%d read FAILED, err: %d", s, s+1, res);
}
Expand All @@ -441,7 +445,7 @@ int cliTestSD(const char ** argv)
}

cliSerialPrint("Starting multiple sector read test, reading 16 sectors at the time");
DRESULT res = __disk_read(0, buffer, sectorCount-16, 16);
DRESULT res = drv->read(0, buffer, sectorCount - 16, 16);
if (res != RES_OK) {
cliSerialPrint("sector %d-%d read FAILED, err: %d", sectorCount-16, sectorCount-1, res);
}
Expand Down
4 changes: 2 additions & 2 deletions radio/src/crc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ uint16_t crc16(uint8_t index, const uint8_t * buf, uint32_t len, uint16_t start)
{
uint16_t crc = start;
const unsigned short * tab = crc16tab[index];
for (uint32_t i=0; i<len; i++) {
crc = (crc<<8) ^ tab[((crc>>8) ^ *buf++) & 0x00FF];
for (uint32_t i = 0; i < len; i++) {
crc = (crc << 8) ^ tab[((crc >> 8) ^ *buf++) & 0x00FF];
}
return crc;
}
Expand Down
6 changes: 3 additions & 3 deletions radio/src/datastructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ static inline void check_struct()
CHKSIZE(ModelData, 6706);
#elif defined(PCBHORUS)
#if defined(PCBX10)
CHKSIZE(RadioData, 916);
CHKSIZE(RadioData, 848);
CHKSIZE(ModelData, 15607);
#else
CHKSIZE(RadioData, 916);
CHKSIZE(RadioData, 848);
CHKSIZE(ModelData, 15607);
#endif
#elif defined(PCBNV14)
CHKSIZE(RadioData, 916);
CHKSIZE(RadioData, 848);
CHKSIZE(ModelData, 15463);
#endif

Expand Down
13 changes: 0 additions & 13 deletions radio/src/datastructs_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -830,16 +830,6 @@ PACK(struct TrainerData {
BLUETOOTH_FIELDS
#endif

#if defined(COLORLCD) && !defined(BACKUP)
#include "theme.h"
#define THEME_NAME_LEN 8
#define THEME_DATA \
NOBACKUP(char themeName[THEME_NAME_LEN]); \
NOBACKUP(EdgeTxTheme::PersistentData themeData);
#else
#define THEME_DATA
#endif

#if defined(BUZZER)
#define BUZZER_FIELD int8_t buzzerMode:2 // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
#else
Expand Down Expand Up @@ -934,8 +924,6 @@ PACK(struct RadioData {

EXTRA_GENERAL_FIELDS

THEME_DATA

char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID];

CUST_ATTR(rotEncDirection, r_rotEncDirection, nullptr);
Expand Down Expand Up @@ -992,5 +980,4 @@ PACK(struct RadioData {
#undef SCRIPTS_DATA
#undef CUSTOM_SCREENS_DATA
#undef EXTRA_GENERAL_FIELDS
#undef THEME_DATA
#undef NOBACKUP
Loading

0 comments on commit da9c463

Please sign in to comment.