1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-354 Add comments and use byte shift.

This commit is contained in:
Laurent Lalanne 2016-07-03 20:02:03 +02:00
parent 1a6b0a4d70
commit 9dd894f4a9
2 changed files with 22 additions and 19 deletions

View File

@ -505,18 +505,20 @@ 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 // CFG-NAV5: Position Fixing Mode
#define UBX_CFG_NAV5_FIXMODE_3D_ONLY 2 #define UBX_CFG_NAV5_FIXMODE_2D_ONLY 0x01
#define UBX_CFG_NAV5_FIXMODE_AUTO_2D3D 3 #define UBX_CFG_NAV5_FIXMODE_3D_ONLY 0x02
#define UBX_CFG_NAV5_FIXMODE_AUTO_2D3D 0x03
#define UBX_CFG_NAV5_DYNMODEL_MASK 1 // CFG-NAV5: Bitfield mask
#define UBX_CFG_NAV5_MINELEV_MASK 2 #define UBX_CFG_NAV5_DYNMODEL (1 << 0) // Apply dynamic model settings
#define UBX_CFG_NAV5_FIXMODE_MASK 4 #define UBX_CFG_NAV5_MINELEV (1 << 1) // Apply minimum elevation settings
#define UBX_CFG_NAV5_DRLIMIT_MASK 8 #define UBX_CFG_NAV5_FIXMODE (1 << 2) // Apply fix mode settings
#define UBX_CFG_NAV5_POSITION_MASK 16 #define UBX_CFG_NAV5_DRLIMIT (1 << 3) // Reserved
#define UBX_CFG_NAV5_TIME_MASK 32 #define UBX_CFG_NAV5_POSITION (1 << 4) // Apply position mask settings
#define UBX_CFG_NAV5_STATICHOLD_MASK 64 #define UBX_CFG_NAV5_TIME (1 << 5) // Apply time mask settings
#define UBX_CFG_NAV5_DGPS_MASK 128 #define UBX_CFG_NAV5_STATICHOLD (1 << 6) // Apply static hold settings
#define UBX_CFG_NAV5_DGPS (1 << 7) // Reserved
struct UBX_CFG_NAV5 { struct UBX_CFG_NAV5 {
uint16_t mask; uint16_t mask;
@ -539,12 +541,13 @@ struct UBX_CFG_NAV5 {
uint32_t reserved4; uint32_t reserved4;
} __attribute__((packed)); } __attribute__((packed));
#define UBX_CFG_NAVX5_MIN_MAX_MASK 4 // CFG-NAVX5: Bitfield mask1
#define UBX_CFG_NAVX5_MIN_CNO_MASK 8 #define UBX_CFG_NAVX5_MIN_MAX (1 << 2) // Apply min/max SVs settings
#define UBX_CFG_NAVX5_INIT_3DFIX_MASK 64 #define UBX_CFG_NAVX5_MIN_CNO (1 << 3) // Apply minimum C/N0 setting
#define UBX_CFG_NAVX5_WKN_ROLL_MASK 512 #define UBX_CFG_NAVX5_INIT_3DFIX (1 << 6) // Apply initial 3D fix settings
#define UBX_CFG_NAVX5_PPP_MASK 8192 #define UBX_CFG_NAVX5_WKN_ROLL (1 << 9) // Apply GPS weeknumber rollover settings
#define UBX_CFG_NAVX5_AOP_MASK 16384 #define UBX_CFG_NAVX5_PPP (1 << 13) // Apply PPP flag, only supported on certain product variants
#define UBX_CFG_NAVX5_AOP (1 << 14) // Apply useAOP flag and aopOrbMaxErr setting (AssistNow Autonomous)
struct UBX_CFG_NAVX5 { struct UBX_CFG_NAVX5 {
uint16_t version; uint16_t version;

View File

@ -312,7 +312,7 @@ static void config_nav(uint16_t *bytes_to_send)
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 = UBX_CFG_NAV5_FIXMODE_3D_ONLY; 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 = UBX_CFG_NAV5_DYNMODEL_MASK + UBX_CFG_NAV5_FIXMODE_MASK; status->working_packet.message.payload.cfg_nav5.mask = UBX_CFG_NAV5_DYNMODEL + UBX_CFG_NAV5_FIXMODE;
*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 = UBX_CFG_NAVX5_AOP_MASK; status->working_packet.message.payload.cfg_navx5.mask1 = UBX_CFG_NAVX5_AOP;
*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));
} }