WiP: Simu and modules fixes
This commit is contained in:
@@ -48,7 +48,7 @@ void CurveDataEdit::update()
|
|||||||
uint8_t curvePointsCount = 5 + curve.points;
|
uint8_t curvePointsCount = 5 + curve.points;
|
||||||
|
|
||||||
// Point number
|
// Point number
|
||||||
for (uint8_t i = 0; i < curvePointsCount; i++) {
|
for (int i = 0; i < curvePointsCount; i++) {
|
||||||
auto txt = new StaticText(
|
auto txt = new StaticText(
|
||||||
this,
|
this,
|
||||||
{i * boxWidth + PAGE_PADDING, 10, boxWidth - PAGE_PADDING, boxHeight},
|
{i * boxWidth + PAGE_PADDING, 10, boxWidth - PAGE_PADDING, boxHeight},
|
||||||
@@ -60,7 +60,7 @@ void CurveDataEdit::update()
|
|||||||
// x value
|
// x value
|
||||||
if (curve.type == CURVE_TYPE_CUSTOM) {
|
if (curve.type == CURVE_TYPE_CUSTOM) {
|
||||||
// Adjustable points for custom curves
|
// Adjustable points for custom curves
|
||||||
for (uint8_t i = 0; i < curvePointsCount; i++) {
|
for (int i = 0; i < curvePointsCount; i++) {
|
||||||
int8_t* points = curveAddress(index);
|
int8_t* points = curveAddress(index);
|
||||||
auto pointEdit = new NumberEdit(
|
auto pointEdit = new NumberEdit(
|
||||||
this,
|
this,
|
||||||
|
|||||||
@@ -622,6 +622,16 @@ class ModuleWindow : public FormGroup {
|
|||||||
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (isModuleFlySky(moduleIdx)) {
|
||||||
|
rfChoice = new Choice(this, grid.getFieldSlot(2, 1), STR_FLYSKY_PROTOCOLS, 0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_LR12,
|
||||||
|
GET_DEFAULT(g_model.moduleData[moduleIdx].subType),
|
||||||
|
[=](int32_t newValue) {
|
||||||
|
g_model.moduleData[moduleIdx].subType = newValue;
|
||||||
|
SET_DIRTY();
|
||||||
|
update();
|
||||||
|
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||||
|
});
|
||||||
|
}
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
else if (isModuleMultimodule(moduleIdx)) {
|
else if (isModuleMultimodule(moduleIdx)) {
|
||||||
Choice * mmSubProtocol = nullptr;
|
Choice * mmSubProtocol = nullptr;
|
||||||
|
|||||||
@@ -628,6 +628,13 @@ bool isInternalModuleAvailable(int moduleType)
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined(AFHDS3) || defined(AFHDS2A)) && (defined(INTERNAL_MODULE_AFHDS2A) || defined(INTERNAL_MODULE_AFHDS3))
|
||||||
|
if (moduleType == MODULE_TYPE_AFHDS3) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ struct Data
|
|||||||
#if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)
|
#if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)
|
||||||
void sendByte(uint8_t b)
|
void sendByte(uint8_t b)
|
||||||
{
|
{
|
||||||
|
#if !defined(SIMU)
|
||||||
*ptr++ = b;
|
*ptr++ = b;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* getData()
|
const uint8_t* getData()
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ enum ModuleType {
|
|||||||
MODULE_TYPE_SBUS,
|
MODULE_TYPE_SBUS,
|
||||||
MODULE_TYPE_XJT_LITE_PXX2,
|
MODULE_TYPE_XJT_LITE_PXX2,
|
||||||
MODULE_TYPE_AFHDS3, //no more protocols possible because of 4 bits value
|
MODULE_TYPE_AFHDS3, //no more protocols possible because of 4 bits value
|
||||||
|
//MODULE_TYPE_AFHDS2A,
|
||||||
MODULE_TYPE_COUNT,
|
MODULE_TYPE_COUNT,
|
||||||
MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
|
MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
|
||||||
};
|
};
|
||||||
@@ -222,6 +223,11 @@ enum ModuleSubtypeDSM2 {
|
|||||||
DSM2_PROTO_DSMX,
|
DSM2_PROTO_DSMX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ModuleSubtypeFlysky {
|
||||||
|
FLYSKY_SUBTYPE_AFHDS3=0,
|
||||||
|
FLYSKY_SUBTYPE_AFHDS2A
|
||||||
|
};
|
||||||
|
|
||||||
enum FailsafeModes {
|
enum FailsafeModes {
|
||||||
FAILSAFE_NOT_SET,
|
FAILSAFE_NOT_SET,
|
||||||
FAILSAFE_HOLD,
|
FAILSAFE_HOLD,
|
||||||
|
|||||||
@@ -319,9 +319,22 @@ inline bool isModuleSBUS(uint8_t moduleIdx)
|
|||||||
return g_model.moduleData[moduleIdx].type == MODULE_TYPE_SBUS;
|
return g_model.moduleData[moduleIdx].type == MODULE_TYPE_SBUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool isModuleFlySky(uint8_t idx)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(g_model.moduleData[idx].type == MODULE_TYPE_AFHDS3);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isModuleAFHDS2A(uint8_t idx)
|
||||||
|
{
|
||||||
|
return isModuleFlySky(idx)
|
||||||
|
&& (g_model.moduleData[idx].subType == FLYSKY_SUBTYPE_AFHDS2A);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool isModuleAFHDS3(uint8_t idx)
|
inline bool isModuleAFHDS3(uint8_t idx)
|
||||||
{
|
{
|
||||||
return g_model.moduleData[idx].type == MODULE_TYPE_AFHDS3;
|
return isModuleFlySky(idx)
|
||||||
|
&& (g_model.moduleData[idx].subType == FLYSKY_SUBTYPE_AFHDS3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// order is the same as in enum Protocols in myeeprom.h (none, ppm, pxx, pxx2, dsm, crossfire, multi, r9m, r9m2, sbus)
|
// order is the same as in enum Protocols in myeeprom.h (none, ppm, pxx, pxx2, dsm, crossfire, multi, r9m, r9m2, sbus)
|
||||||
|
|||||||
@@ -187,9 +187,13 @@ uint8_t getRequiredProtocol(uint8_t module)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AFHDS3)
|
#if defined(AFHDS3) || defined(AFHDS2)
|
||||||
case MODULE_TYPE_AFHDS3:
|
case MODULE_TYPE_AFHDS3:
|
||||||
protocol = PROTOCOL_CHANNELS_AFHDS3;
|
if (isModuleAFHDS3(module)) {
|
||||||
|
protocol = PROTOCOL_CHANNELS_AFHDS3;
|
||||||
|
} else if (isModuleAFHDS2A(module)) {
|
||||||
|
protocol = PROTOCOL_CHANNELS_AFHDS2A;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -505,6 +509,14 @@ static void enablePulsesInternalModule(uint8_t protocol)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(AFHDS2)
|
||||||
|
case PROTOCOL_CHANNELS_AFHDS2A:
|
||||||
|
extmodulePulsesData.afhds2.init(INTERNAL_MODULE);
|
||||||
|
extmoduleSerialStart();
|
||||||
|
mixerSchedulerSetPeriod(INTERNAL_MODULE, 2 * 1000 /* us */);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// internal module stopped, set internal period to 0 and start the scheduler
|
// internal module stopped, set internal period to 0 and start the scheduler
|
||||||
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ union InternalModulePulsesData {
|
|||||||
#if defined(INTERNAL_MODULE_PPM)
|
#if defined(INTERNAL_MODULE_PPM)
|
||||||
PpmPulsesData<pulse_duration_t> ppm;
|
PpmPulsesData<pulse_duration_t> ppm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} __ALIGNED(4);
|
} __ALIGNED(4);
|
||||||
|
|
||||||
union ExternalModulePulsesData {
|
union ExternalModulePulsesData {
|
||||||
@@ -389,6 +390,7 @@ enum ChannelsProtocols {
|
|||||||
PROTOCOL_CHANNELS_SBUS,
|
PROTOCOL_CHANNELS_SBUS,
|
||||||
PROTOCOL_CHANNELS_PXX2_LOWSPEED,
|
PROTOCOL_CHANNELS_PXX2_LOWSPEED,
|
||||||
PROTOCOL_CHANNELS_PXX2_HIGHSPEED,
|
PROTOCOL_CHANNELS_PXX2_HIGHSPEED,
|
||||||
|
PROTOCOL_CHANNELS_AFHDS2A,
|
||||||
PROTOCOL_CHANNELS_AFHDS3,
|
PROTOCOL_CHANNELS_AFHDS3,
|
||||||
PROTOCOL_CHANNELS_GHOST
|
PROTOCOL_CHANNELS_GHOST
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void interrupt1ms()
|
|||||||
++pre_scale;
|
++pre_scale;
|
||||||
|
|
||||||
// 1 ms loop
|
// 1 ms loop
|
||||||
#if defined(FLYSKY_HALL_STICKS)
|
#if defined(FLYSKY_HALL_STICKS) && !defined(SIMU)
|
||||||
flysky_hall_stick_loop(); // TODO: need to put in 1ms timer loop for best performance
|
flysky_hall_stick_loop(); // TODO: need to put in 1ms timer loop for best performance
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ set(FLAVOUR nv14)
|
|||||||
#add_definitions(-DPCBNV14 -DPCBFLYSKY -DINTERNAL_MODULE_BAUDRATE=${PCB_RF_BAUD})
|
#add_definitions(-DPCBNV14 -DPCBFLYSKY -DINTERNAL_MODULE_BAUDRATE=${PCB_RF_BAUD})
|
||||||
add_definitions(-DPCBNV14 -DPCBFLYSKY -DINTERNAL_MODULE_SERIAL -DAFHDS2_BAUDRATE=${PCB_RF_BAUD})
|
add_definitions(-DPCBNV14 -DPCBFLYSKY -DINTERNAL_MODULE_SERIAL -DAFHDS2_BAUDRATE=${PCB_RF_BAUD})
|
||||||
add_definitions(-DBATTERY_CHARGE) # -DSOFTWARE_VOLUME
|
add_definitions(-DBATTERY_CHARGE) # -DSOFTWARE_VOLUME
|
||||||
|
add_definitions(-DINTERNAL_MODULE_AFHDS2A)
|
||||||
|
|
||||||
set(TARGET_SRC
|
set(TARGET_SRC
|
||||||
${TARGET_SRC}
|
${TARGET_SRC}
|
||||||
|
|||||||
@@ -297,13 +297,13 @@ void adcRead()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(SIMU)
|
||||||
uint16_t getRTCBatteryVoltage()
|
uint16_t getRTCBatteryVoltage()
|
||||||
{
|
{
|
||||||
#warning "TODO RTC voltage"
|
#warning "TODO RTC voltage"
|
||||||
return 330;
|
return 330;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(SIMU)
|
|
||||||
uint16_t getAnalogValue(uint8_t index)
|
uint16_t getAnalogValue(uint8_t index)
|
||||||
{
|
{
|
||||||
if (IS_POT(index) && !IS_POT_SLIDER_AVAILABLE(index)) {
|
if (IS_POT(index) && !IS_POT_SLIDER_AVAILABLE(index)) {
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ void telemetryPortInit(uint32_t baudrate, uint8_t mode);
|
|||||||
void telemetryPortSetDirectionOutput();
|
void telemetryPortSetDirectionOutput();
|
||||||
void telemetryPortSetDirectionInput();
|
void telemetryPortSetDirectionInput();
|
||||||
void sportSendBuffer(uint8_t * buffer, uint32_t count);
|
void sportSendBuffer(uint8_t * buffer, uint32_t count);
|
||||||
uint8_t telemetryGetByte(uint8_t * byte);
|
bool telemetryGetByte(uint8_t * byte);
|
||||||
void telemetryClearFifo();
|
void telemetryClearFifo();
|
||||||
void sportSendByte(uint8_t byte);
|
void sportSendByte(uint8_t byte);
|
||||||
extern uint32_t telemetryErrors;
|
extern uint32_t telemetryErrors;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ constexpr uint32_t MENU_FOOTER_TOP = LCD_H - MENU_FOOTER_HEIGHT;
|
|||||||
constexpr uint32_t MENU_BODY_HEIGHT = MENU_FOOTER_TOP - MENU_BODY_TOP;
|
constexpr uint32_t MENU_BODY_HEIGHT = MENU_FOOTER_TOP - MENU_BODY_TOP;
|
||||||
constexpr uint32_t MENUS_MARGIN_LEFT = 6;
|
constexpr uint32_t MENUS_MARGIN_LEFT = 6;
|
||||||
|
|
||||||
constexpr uint32_t PAGE_PADDING = 8;
|
constexpr coord_t PAGE_PADDING = 8;
|
||||||
constexpr uint32_t PAGE_LINE_HEIGHT = 26;
|
constexpr uint32_t PAGE_LINE_HEIGHT = 26;
|
||||||
constexpr uint32_t PAGE_LINE_SPACING = 6;
|
constexpr uint32_t PAGE_LINE_SPACING = 6;
|
||||||
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
|
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ void sportSendByte(uint8_t byte)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void sportSendBuffer(const uint8_t * buffer, uint32_t count)
|
void sportSendBuffer(uint8_t * buffer, uint32_t count)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ extern const char STR_XJT_ACCST_RF_PROTOCOLS[];
|
|||||||
extern const char STR_ISRM_RF_PROTOCOLS[];
|
extern const char STR_ISRM_RF_PROTOCOLS[];
|
||||||
extern const char STR_R9M_PXX2_RF_PROTOCOLS[];
|
extern const char STR_R9M_PXX2_RF_PROTOCOLS[];
|
||||||
extern const char STR_DSM_PROTOCOLS[];
|
extern const char STR_DSM_PROTOCOLS[];
|
||||||
|
extern const char STR_FLYSKY_PROTOCOLS[];
|
||||||
extern const char STR_CRSF_BAUDRATE[];
|
extern const char STR_CRSF_BAUDRATE[];
|
||||||
extern const char STR_PPM_POL[];
|
extern const char STR_PPM_POL[];
|
||||||
extern const char STR_SBUS_INVERSION_VALUES[];
|
extern const char STR_SBUS_INVERSION_VALUES[];
|
||||||
|
|||||||
@@ -111,10 +111,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LEN_EXTERNAL_MODULE_PROTOCOLS "\014"
|
#define LEN_EXTERNAL_MODULE_PROTOCOLS "\014"
|
||||||
#define TR_EXTERNAL_MODULE_PROTOCOLS "OFF\0 ""PPM\0 ""XJT\0 ""ISRM\0 ""DSM2\0 ""CRSF\0 ""MULTI\0 ""R9M\0 ""R9M ACCESS\0 " TR_MODULE_R9M_LITE "R9ML ACCESS\0""GHST\0 ""R9MLP ACCESS""SBUS\0 ""XJT Lite\0 ""AFHDS3\0 "
|
#define TR_EXTERNAL_MODULE_PROTOCOLS "OFF\0 ""PPM\0 ""XJT\0 ""ISRM\0 ""DSM2\0 ""CRSF\0 ""MULTI\0 ""R9M\0 ""R9M ACCESS\0 " TR_MODULE_R9M_LITE "R9ML ACCESS\0""GHST\0 ""R9MLP ACCESS""SBUS\0 ""XJT Lite\0 ""FLYSKY\0 "
|
||||||
|
|
||||||
#define LEN_FLYSKY_PROTOCOLS "\006"
|
#define LEN_FLYSKY_PROTOCOLS "\007"
|
||||||
#define TR_FLYSKY_PROTOCOLS
|
#define TR_FLYSKY_PROTOCOLS "AFHDS3\0""AFHDS2A"
|
||||||
|
|
||||||
#define LEN_INTERNAL_MODULE_PROTOCOLS LEN_EXTERNAL_MODULE_PROTOCOLS
|
#define LEN_INTERNAL_MODULE_PROTOCOLS LEN_EXTERNAL_MODULE_PROTOCOLS
|
||||||
#define TR_INTERNAL_MODULE_PROTOCOLS TR_EXTERNAL_MODULE_PROTOCOLS
|
#define TR_INTERNAL_MODULE_PROTOCOLS TR_EXTERNAL_MODULE_PROTOCOLS
|
||||||
|
|||||||
Reference in New Issue
Block a user