Skip to content

Commit

Permalink
Merge pull request iNavFlight#8401 from iNavFlight/MrD_Add-USER-3-and…
Browse files Browse the repository at this point in the history
…-USER-4-PINIO-Also-MATEKF722PX_PINIO-target

Add PINIO 3 & 4 plus MATEKF722PX_PINIO target
  • Loading branch information
MrD-RC authored Nov 15, 2022
2 parents 0c3db77 + aab4b05 commit 37c6434
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 7 deletions.
16 changes: 16 additions & 0 deletions docs/boards/Matek F722PX-WPX-HD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Board - MATEKSYS F722-PX/WPX/HD

## Vendor Information / specification
http://www.mateksys.com/?portfolio=f722-px
http://www.mateksys.com/?portfolio=f722-wpx
http://www.mateksys.com/?portfolio=f722-hd

## Firmware

Three firmware variants are available.

* `inav_x.y.z_MATEKF722PX.hex`
* `inav_x.y.z_MATEKF722WPX.hex`
* `inav_x.y.z_MATEKF722PX_PINIO.hex`

The WPX vairant is for the MATEK F722-WPX wing flight controller. The PX variants are for the MATEK F722-PX and MATEK F722-HD flight controllers. The PINIO variant adds USER 3 PINIO as a replacement to UART 5 TX and USER 4 PINIO as a replacement to UART 5 RX.
13 changes: 8 additions & 5 deletions src/main/fc/fc_msp_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,19 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = {
{ .boxId = BOXOSDALT3, .boxName = "OSD ALT 3", .permanentId = 44 },
{ .boxId = BOXNAVCOURSEHOLD, .boxName = "NAV COURSE HOLD", .permanentId = 45 },
{ .boxId = BOXBRAKING, .boxName = "MC BRAKING", .permanentId = 46 },
{ .boxId = BOXUSER1, .boxName = "USER1", .permanentId = BOX_PERMANENT_ID_USER1 },
{ .boxId = BOXUSER2, .boxName = "USER2", .permanentId = BOX_PERMANENT_ID_USER2 },
{ .boxId = BOXUSER3, .boxName = "USER3", .permanentId = BOX_PERMANENT_ID_USER3 },
{ .boxId = BOXUSER1, .boxName = "USER1", .permanentId = BOX_PERMANENT_ID_USER1 }, // 47
{ .boxId = BOXUSER2, .boxName = "USER2", .permanentId = BOX_PERMANENT_ID_USER2 }, // 48
{ .boxId = BOXUSER3, .boxName = "USER3", .permanentId = BOX_PERMANENT_ID_USER3 }, // 57
{ .boxId = BOXUSER4, .boxName = "USER4", .permanentId = BOX_PERMANENT_ID_USER4 }, // 58
{ .boxId = BOXLOITERDIRCHN, .boxName = "LOITER CHANGE", .permanentId = 49 },
{ .boxId = BOXMSPRCOVERRIDE, .boxName = "MSP RC OVERRIDE", .permanentId = 50 },
{ .boxId = BOXPREARM, .boxName = "PREARM", .permanentId = 51 },
{ .boxId = BOXTURTLE, .boxName = "TURTLE", .permanentId = 52 },
{ .boxId = BOXNAVCRUISE, .boxName = "NAV CRUISE", .permanentId = 53 },
{ .boxId = BOXAUTOLEVEL, .boxName = "AUTO LEVEL", .permanentId = 54 },
{ .boxId = BOXPLANWPMISSION, .boxName = "WP PLANNER", .permanentId = 55 },
{ .boxId = BOXSOARING, .boxName = "SOARING", .permanentId = 56 },
{ .boxId = BOXLOITERDIRCHN, .boxName = "LOITER CHANGE", .permanentId = 57 },
{ .boxId = BOXCHANGEMISSION, .boxName = "MISSION CHANGE", .permanentId = 58 },
{ .boxId = BOXCHANGEMISSION, .boxName = "MISSION CHANGE", .permanentId = 59 },
{ .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF }
};

Expand Down Expand Up @@ -319,6 +320,7 @@ void initActiveBoxIds(void)
ADD_ACTIVE_BOX(BOXUSER1);
ADD_ACTIVE_BOX(BOXUSER2);
ADD_ACTIVE_BOX(BOXUSER3);
ADD_ACTIVE_BOX(BOXUSER4);
#endif

#if defined(USE_OSD) && defined(OSD_LAYOUT_COUNT)
Expand Down Expand Up @@ -397,6 +399,7 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags)
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXUSER1)), BOXUSER1);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXUSER2)), BOXUSER2);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXUSER3)), BOXUSER3);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXUSER4)), BOXUSER4);
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLOITERDIRCHN)), BOXLOITERDIRCHN);
#if defined(USE_RX_MSP) && defined(USE_MSP_RC_OVERRIDE)
CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXMSPRCOVERRIDE)), BOXMSPRCOVERRIDE);
Expand Down
3 changes: 2 additions & 1 deletion src/main/fc/rc_modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ typedef enum {
BOXPLANWPMISSION = 46,
BOXSOARING = 47,
BOXUSER3 = 48,
BOXCHANGEMISSION = 49,
BOXUSER4 = 49,
BOXCHANGEMISSION = 50,
CHECKBOX_ITEM_COUNT
} boxId_e;

Expand Down
3 changes: 2 additions & 1 deletion src/main/io/piniobox.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

#define BOX_PERMANENT_ID_USER1 47
#define BOX_PERMANENT_ID_USER2 48
#define BOX_PERMANENT_ID_USER3 49
#define BOX_PERMANENT_ID_USER3 57
#define BOX_PERMANENT_ID_USER4 58
#define BOX_PERMANENT_ID_NONE 255 // A permanent ID for no box mode


Expand Down
4 changes: 4 additions & 0 deletions src/main/programming/logic_condition.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ static int logicConditionGetFlightModeOperandValue(int operand) {
return IS_RC_MODE_ACTIVE(BOXUSER3);
break;

case LOGIC_CONDITION_OPERAND_FLIGHT_MODE_USER4:
return IS_RC_MODE_ACTIVE(BOXUSER4);
break;

default:
return 0;
break;
Expand Down
1 change: 1 addition & 0 deletions src/main/programming/logic_condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ typedef enum {
LOGIC_CONDITION_OPERAND_FLIGHT_MODE_USER2, // 10
LOGIC_CONDITION_OPERAND_FLIGHT_MODE_COURSE_HOLD, // 11
LOGIC_CONDITION_OPERAND_FLIGHT_MODE_USER3, // 12
LOGIC_CONDITION_OPERAND_FLIGHT_MODE_USER4, // 13
} logicFlightModeOperands_e;

typedef enum {
Expand Down
1 change: 1 addition & 0 deletions src/main/target/MATEKF722PX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target_stm32f722xe(MATEKF722PX)
target_stm32f722xe(MATEKF722PX_PINIO)
target_stm32f722xe(MATEKF722WPX)
4 changes: 4 additions & 0 deletions src/main/target/MATEKF722PX/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ void targetConfiguration(void)
{
pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1;
pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2;
#ifdef MATEKF722PX_PINIO
pinioBoxConfigMutable()->permanentId[2] = BOX_PERMANENT_ID_USER3;
pinioBoxConfigMutable()->permanentId[3] = BOX_PERMANENT_ID_USER4;
#endif

serialConfigMutable()->portConfigs[6].functionMask = FUNCTION_FRSKY_OSD;
}
7 changes: 7 additions & 0 deletions src/main/target/MATEKF722PX/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@
#define UART4_TX_PIN PA0
#define UART4_RX_PIN PA1

#ifndef MATEKF722PX_PINIO
#define USE_UART5
#define UART5_TX_PIN PC12
#define UART5_RX_PIN PD2
#endif

#define USE_UART6
#define UART6_TX_PIN PC6
Expand Down Expand Up @@ -150,6 +152,11 @@
#define PINIO1_PIN PA15 // Power switch
#define PINIO2_PIN PB3 // Camera switch

#ifdef MATEKF722PX_PINIO
#define PINIO3_PIN PC12 // UART 5 TX - USER 3 PINIO
#define PINIO4_PIN PD2 // UART 5 RX - USER 4 PINIO
#endif

// *************** LEDSTRIP ************************
#define USE_LED_STRIP
#define WS2811_PIN PA8
Expand Down

0 comments on commit 37c6434

Please sign in to comment.