mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
pga460: Change variable initialization to uniform initialization style, format whitespace, and change baud rate unsigned to speed_t type. (#11861)
This commit is contained in:
@@ -41,8 +41,6 @@
|
|||||||
#include "pga460.h"
|
#include "pga460.h"
|
||||||
|
|
||||||
|
|
||||||
extern "C" __EXPORT int pga460_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
PGA460::PGA460(const char *port)
|
PGA460::PGA460(const char *port)
|
||||||
{
|
{
|
||||||
// Store port name.
|
// Store port name.
|
||||||
@@ -313,7 +311,6 @@ int PGA460::open_serial()
|
|||||||
// no NL to CR translation, don't mark parity errors or breaks
|
// no NL to CR translation, don't mark parity errors or breaks
|
||||||
// no input parity check, don't strip high bit off,
|
// no input parity check, don't strip high bit off,
|
||||||
// no XON/XOFF software flow control
|
// no XON/XOFF software flow control
|
||||||
//
|
|
||||||
uart_config.c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | IGNCR | PARMRK | INPCK | ISTRIP | IXON | IXOFF);
|
uart_config.c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | IGNCR | PARMRK | INPCK | ISTRIP | IXON | IXOFF);
|
||||||
|
|
||||||
uart_config.c_iflag |= IGNPAR;
|
uart_config.c_iflag |= IGNPAR;
|
||||||
@@ -339,7 +336,7 @@ int PGA460::open_serial()
|
|||||||
|
|
||||||
uart_config.c_cc[VTIME] = 0;
|
uart_config.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
unsigned speed = 115200;
|
speed_t speed = 115200;
|
||||||
|
|
||||||
// Set the baud rate.
|
// Set the baud rate.
|
||||||
if ((termios_state = cfsetispeed(&uart_config, speed)) < 0) {
|
if ((termios_state = cfsetispeed(&uart_config, speed)) < 0) {
|
||||||
@@ -899,7 +896,7 @@ int PGA460::write_register(const uint8_t reg, const uint8_t val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pga460_main(int argc, char *argv[])
|
extern "C" __EXPORT int pga460_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return PGA460::main(argc, argv);
|
return PGA460::main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,28 +385,28 @@ private:
|
|||||||
void uORB_publish_results(const float dist);
|
void uORB_publish_results(const float dist);
|
||||||
|
|
||||||
/** @orb_advert_t orb_advert_t uORB advertisement topic. */
|
/** @orb_advert_t orb_advert_t uORB advertisement topic. */
|
||||||
orb_advert_t _distance_sensor_topic = nullptr;
|
orb_advert_t _distance_sensor_topic{nullptr};
|
||||||
|
|
||||||
/** @param _fd Returns the file descriptor from px4_open(). */
|
/** @param _fd Returns the file descriptor from px4_open(). */
|
||||||
int _fd = -1;
|
int _fd{-1};
|
||||||
|
|
||||||
/** @param _port Stores the port name. */
|
/** @param _port Stores the port name. */
|
||||||
char _port[20];
|
char _port[20] {};
|
||||||
|
|
||||||
/** @param _previous_report_distance The previous reported sensor distance. */
|
/** @param _previous_report_distance The previous reported sensor distance. */
|
||||||
float _previous_report_distance = 0;
|
float _previous_report_distance{0};
|
||||||
|
|
||||||
/** @param _previous_valid_report_distance The previous valid reported sensor distance. */
|
/** @param _previous_valid_report_distance The previous valid reported sensor distance. */
|
||||||
float _previous_valid_report_distance = 0;
|
float _previous_valid_report_distance{0};
|
||||||
|
|
||||||
/** @param _resonant_frequency The sensor resonant (transmit) frequency. */
|
/** @param _resonant_frequency The sensor resonant (transmit) frequency. */
|
||||||
float _resonant_frequency = 41.0f;
|
float _resonant_frequency{41.0f};
|
||||||
|
|
||||||
/** @param _mode_long_range Flag for long range mode. If false, sensor is in short range mode. */
|
/** @param _mode_long_range Flag for long range mode. If false, sensor is in short range mode. */
|
||||||
uint8_t _ranging_mode = MODE_SHORT_RANGE;
|
uint8_t _ranging_mode{MODE_SHORT_RANGE};
|
||||||
|
|
||||||
/** @param _start_loop The starting value for the loop time of the main loop. */
|
/** @param _start_loop The starting value for the loop time of the main loop. */
|
||||||
uint64_t _start_loop = 0;
|
uint64_t _start_loop{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user