New UI merged
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@ enum ModuleType {
|
||||
MODULE_TYPE_R9M_LITE_PRO_PXX2,
|
||||
MODULE_TYPE_SBUS,
|
||||
MODULE_TYPE_XJT_LITE_PXX2,
|
||||
MODULE_TYPE_FLYSKY,
|
||||
MODULE_TYPE_COUNT,
|
||||
MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#if defined(MULTIMODULE)
|
||||
inline bool isModuleMultimodule(uint8_t idx)
|
||||
{
|
||||
return idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE;
|
||||
return g_model.moduleData[idx].type == MODULE_TYPE_MULTIMODULE;
|
||||
}
|
||||
|
||||
inline bool isModuleMultimoduleDSM2(uint8_t idx)
|
||||
@@ -110,6 +110,18 @@ inline bool isModuleCrossfire(uint8_t idx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBFLYSKY)
|
||||
inline bool isModuleFlysky(uint8_t idx)
|
||||
{
|
||||
return g_model.moduleData[idx].type == MODULE_TYPE_FLYSKY;
|
||||
}
|
||||
#else
|
||||
inline bool isModuleFlysky(uint8_t idx)
|
||||
{
|
||||
return idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_FLYSKY;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
inline bool isExtraModule(uint8_t idx)
|
||||
{
|
||||
@@ -256,8 +268,8 @@ inline bool isModuleSBUS(uint8_t moduleIdx)
|
||||
}
|
||||
|
||||
// order is the same as in enum Protocols in myeeprom.h (none, ppm, pxx, pxx2, dsm, crossfire, multi, r9m, r9m2, sbus)
|
||||
static const int8_t maxChannelsModules[] = { 0, 8, 8, 16, -2, 8, 4, 8, 16, 8}; // relative to 8!
|
||||
static const int8_t maxChannelsXJT[] = { 0, 8, 0, 4 }; // relative to 8!
|
||||
static const int8_t maxChannelsModules_M8[] = { 0, 8, 8, 16, -2, 8, 4, 8, 16, 8}; // relative to 8!
|
||||
static const int8_t maxChannelsXJT_M8[] = { 0, 8, 0, 4 }; // relative to 8!
|
||||
|
||||
constexpr int8_t MAX_TRAINER_CHANNELS_M8 = MAX_TRAINER_CHANNELS - 8;
|
||||
constexpr int8_t MAX_EXTRA_MODULE_CHANNELS_M8 = 8; // only 16ch PPM
|
||||
@@ -268,7 +280,7 @@ inline int8_t maxModuleChannels_M8(uint8_t moduleIdx)
|
||||
return MAX_EXTRA_MODULE_CHANNELS_M8;
|
||||
}
|
||||
else if (isModuleXJT(moduleIdx)) {
|
||||
return maxChannelsXJT[1 + g_model.moduleData[moduleIdx].subType];
|
||||
return maxChannelsXJT_M8[1 + g_model.moduleData[moduleIdx].subType];
|
||||
}
|
||||
else if (isModuleR9M(moduleIdx)) {
|
||||
if (isModuleR9M_LBT(moduleIdx)) {
|
||||
@@ -282,10 +294,23 @@ inline int8_t maxModuleChannels_M8(uint8_t moduleIdx)
|
||||
}
|
||||
}
|
||||
else {
|
||||
return maxChannelsModules[g_model.moduleData[moduleIdx].type];
|
||||
return maxChannelsModules_M8[g_model.moduleData[moduleIdx].type];
|
||||
}
|
||||
}
|
||||
|
||||
inline int8_t maxModuleChannels(uint8_t moduleIdx)
|
||||
{
|
||||
return maxModuleChannels_M8(moduleIdx) + 8;
|
||||
}
|
||||
|
||||
inline int8_t minModuleChannels(uint8_t idx)
|
||||
{
|
||||
if (isModuleCrossfire(idx))
|
||||
return 16;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int8_t defaultModuleChannels_M8(uint8_t idx)
|
||||
{
|
||||
if (isModulePPM(idx))
|
||||
@@ -300,6 +325,8 @@ inline int8_t defaultModuleChannels_M8(uint8_t idx)
|
||||
return 4; // 12 channels
|
||||
else if (isModulePXX2(idx))
|
||||
return 8; // 16 channels
|
||||
else if (isModuleFlysky(idx))
|
||||
return 6; // 14 channels
|
||||
else
|
||||
return maxModuleChannels_M8(idx);
|
||||
}
|
||||
@@ -336,6 +363,29 @@ inline bool isModuleRxNumAvailable(uint8_t moduleIdx)
|
||||
if (isModuleMultimodule(moduleIdx))
|
||||
return true;
|
||||
|
||||
if(isModuleMultimodule(moduleIdx))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool isModuleModelIndexAvailable(uint8_t idx)
|
||||
{
|
||||
if (isModuleXJT(idx))
|
||||
return g_model.moduleData[idx].subType != MODULE_SUBTYPE_PXX1_ACCST_D8;
|
||||
|
||||
if (isModuleR9M(idx))
|
||||
return true;
|
||||
|
||||
if (isModuleDSM2(idx))
|
||||
return true;
|
||||
|
||||
if (isModuleISRM(idx))
|
||||
return true;
|
||||
|
||||
if (isModuleMultimodule(idx))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
extern uint8_t dsm2BindTimer;
|
||||
#endif
|
||||
|
||||
#if defined(PCBFLYSKY)
|
||||
#define IS_FLYSKY_PROTOCOL(protocol) (protocol==PROTO_FLYSKY)
|
||||
#else
|
||||
#define IS_FLYSKY_PROTOCOL(protocol) (0)
|
||||
#endif
|
||||
|
||||
#if defined(DSM2)
|
||||
#define IS_DSM2_PROTOCOL(protocol) (protocol>=PROTOCOL_CHANNELS_DSM2_LP45 && protocol<=PROTOCOL_CHANNELS_DSM2_DSMX)
|
||||
#else
|
||||
@@ -350,6 +356,7 @@ enum ChannelsProtocols {
|
||||
PROTOCOL_CHANNELS_SBUS,
|
||||
PROTOCOL_CHANNELS_PXX2_LOWSPEED,
|
||||
PROTOCOL_CHANNELS_PXX2_HIGHSPEED,
|
||||
PROTOCOL_CHANNELS_FLYSKY
|
||||
};
|
||||
|
||||
inline void stopPulses()
|
||||
|
||||
@@ -253,9 +253,11 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
|
||||
|
||||
if (destination->step == BIND_WAIT) {
|
||||
if (get_tmr10ms() > destination->timeout) {
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
destination->step = BIND_OK;
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
#if !defined(COLORLCD)
|
||||
POPUP_INFORMATION(STR_BIND_OK); // TODO rather use the new callback
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -451,7 +453,7 @@ const char * Pxx2OtaUpdate::nextStep(uint8_t step, const char * rxName, uint32_t
|
||||
}
|
||||
}
|
||||
|
||||
const char * Pxx2OtaUpdate::doFlashFirmware(const char * filename)
|
||||
const char * Pxx2OtaUpdate::doFlashFirmware(const char * filename, ProgressHandler progressHandler)
|
||||
{
|
||||
FIL file;
|
||||
uint8_t buffer[32];
|
||||
@@ -483,7 +485,7 @@ const char * Pxx2OtaUpdate::doFlashFirmware(const char * filename)
|
||||
|
||||
uint32_t done = 0;
|
||||
while (1) {
|
||||
drawProgressScreen(getBasename(filename), STR_OTA_UPDATE, done, size);
|
||||
progressHandler(getBasename(filename), STR_OTA_UPDATE, done, size);
|
||||
if (f_read(&file, buffer, sizeof(buffer), &count) != FR_OK) {
|
||||
f_close(&file);
|
||||
return "Read file failed";
|
||||
@@ -505,7 +507,7 @@ const char * Pxx2OtaUpdate::doFlashFirmware(const char * filename)
|
||||
return nextStep(OTA_UPDATE_EOF, nullptr, done, nullptr);
|
||||
}
|
||||
|
||||
void Pxx2OtaUpdate::flashFirmware(const char * filename)
|
||||
void Pxx2OtaUpdate::flashFirmware(const char * filename, ProgressHandler progressHandler)
|
||||
{
|
||||
pausePulses();
|
||||
|
||||
@@ -513,7 +515,7 @@ void Pxx2OtaUpdate::flashFirmware(const char * filename)
|
||||
RTOS_WAIT_MS(100);
|
||||
|
||||
moduleState[module].mode = MODULE_MODE_OTA_UPDATE;
|
||||
const char * result = doFlashFirmware(filename);
|
||||
const char * result = doFlashFirmware(filename, progressHandler);
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
|
||||
AUDIO_PLAY(AU_SPECIAL_SOUND_BEEP1 );
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "fifo.h"
|
||||
#include "io/frsky_pxx2.h"
|
||||
#include "popups.h"
|
||||
#include "./pxx.h"
|
||||
|
||||
#define PXX2_TYPE_C_MODULE 0x01
|
||||
@@ -430,13 +431,13 @@ class Pxx2OtaUpdate {
|
||||
{
|
||||
}
|
||||
|
||||
void flashFirmware(const char * filename);
|
||||
void flashFirmware(const char * filename, ProgressHandler progressHandler);
|
||||
|
||||
protected:
|
||||
uint8_t module;
|
||||
const char * rxName;
|
||||
|
||||
const char * doFlashFirmware(const char * filename);
|
||||
const char * doFlashFirmware(const char * filename, ProgressHandler progressHandler);
|
||||
bool waitStep(uint8_t step, uint8_t timeout);
|
||||
const char * nextStep(uint8_t step, const char * rxName, uint32_t address, const uint8_t * buffer);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user