1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

LP-354 Define Nav5 and Navx5 constants in UBX.h

This commit is contained in:
Laurent Lalanne 2016-07-03 18:44:45 +02:00
parent 831f8265e7
commit 1a6b0a4d70
2 changed files with 24 additions and 4 deletions

View File

@ -42,7 +42,7 @@
#define UBX_HW_VERSION_8 80000 #define UBX_HW_VERSION_8 80000
#define UBX_HW_VERSION_7 70000 #define UBX_HW_VERSION_7 70000
#define UBX_HW_VERSION_6 60000
#define UBX_HW_VERSION_5 50000 #define UBX_HW_VERSION_5 50000
#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters #define UBX_SYNC1 0xb5 // UBX protocol synchronization characters
@ -505,6 +505,19 @@ struct UBX_CFG_GNSS {
struct UBX_CFG_GNSS_CFGBLOCK cfgBlocks[UBX_GNSS_ID_MAX]; struct UBX_CFG_GNSS_CFGBLOCK cfgBlocks[UBX_GNSS_ID_MAX];
} __attribute__((packed)); } __attribute__((packed));
#define UBX_CFG_NAV5_FIXMODE_2D_ONLY 1
#define UBX_CFG_NAV5_FIXMODE_3D_ONLY 2
#define UBX_CFG_NAV5_FIXMODE_AUTO_2D3D 3
#define UBX_CFG_NAV5_DYNMODEL_MASK 1
#define UBX_CFG_NAV5_MINELEV_MASK 2
#define UBX_CFG_NAV5_FIXMODE_MASK 4
#define UBX_CFG_NAV5_DRLIMIT_MASK 8
#define UBX_CFG_NAV5_POSITION_MASK 16
#define UBX_CFG_NAV5_TIME_MASK 32
#define UBX_CFG_NAV5_STATICHOLD_MASK 64
#define UBX_CFG_NAV5_DGPS_MASK 128
struct UBX_CFG_NAV5 { struct UBX_CFG_NAV5 {
uint16_t mask; uint16_t mask;
uint8_t dynModel; uint8_t dynModel;
@ -526,6 +539,13 @@ struct UBX_CFG_NAV5 {
uint32_t reserved4; uint32_t reserved4;
} __attribute__((packed)); } __attribute__((packed));
#define UBX_CFG_NAVX5_MIN_MAX_MASK 4
#define UBX_CFG_NAVX5_MIN_CNO_MASK 8
#define UBX_CFG_NAVX5_INIT_3DFIX_MASK 64
#define UBX_CFG_NAVX5_WKN_ROLL_MASK 512
#define UBX_CFG_NAVX5_PPP_MASK 8192
#define UBX_CFG_NAVX5_AOP_MASK 16384
struct UBX_CFG_NAVX5 { struct UBX_CFG_NAVX5 {
uint16_t version; uint16_t version;
uint16_t mask1; uint16_t mask1;

View File

@ -310,9 +310,9 @@ static void config_nav(uint16_t *bytes_to_send)
{ {
memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_nav5_t)); memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_nav5_t));
status->working_packet.message.payload.cfg_nav5.dynModel = status->currentSettings.dynamicModel; status->working_packet.message.payload.cfg_nav5.dynModel = status->currentSettings.dynamicModel;
status->working_packet.message.payload.cfg_nav5.fixMode = 2; // 1=2D only, 2=3D only, 3=Auto 2D/3D status->working_packet.message.payload.cfg_nav5.fixMode = UBX_CFG_NAV5_FIXMODE_3D_ONLY;
// mask LSB=dyn|minEl|posFixMode|drLim|posMask|statisticHoldMask|dgpsMask|......|reservedBit0 = MSB // mask LSB=dyn|minEl|posFixMode|drLim|posMask|statisticHoldMask|dgpsMask|......|reservedBit0 = MSB
status->working_packet.message.payload.cfg_nav5.mask = 0x01 + 0x04; // Dyn Model | posFixMode configuration status->working_packet.message.payload.cfg_nav5.mask = UBX_CFG_NAV5_DYNMODEL_MASK + UBX_CFG_NAV5_FIXMODE_MASK;
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAV5, sizeof(ubx_cfg_nav5_t)); *bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAV5, sizeof(ubx_cfg_nav5_t));
} }
@ -321,7 +321,7 @@ static void config_navx(uint16_t *bytes_to_send)
{ {
memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_navx5_t)); memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_navx5_t));
status->working_packet.message.payload.cfg_navx5.useAOP = status->currentSettings.AssistNowAutonomous; status->working_packet.message.payload.cfg_navx5.useAOP = status->currentSettings.AssistNowAutonomous;
status->working_packet.message.payload.cfg_navx5.mask1 = 0x4000; // aop configuration status->working_packet.message.payload.cfg_navx5.mask1 = UBX_CFG_NAVX5_AOP_MASK;
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAVX5, sizeof(ubx_cfg_navx5_t)); *bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAVX5, sizeof(ubx_cfg_navx5_t));
} }