Skip to content

Commit 2bbc638

Browse files
committed
Clang
1 parent ab7cc41 commit 2bbc638

File tree

7 files changed

+52
-38
lines changed

7 files changed

+52
-38
lines changed

src/Wippersnapper_V2.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ void Wippersnapper_V2::provision() {
9898
return; // SD card initialized, cede control back to loop()
9999
} else {
100100
haltErrorV2(("SD initialization failed.\nDo not reformat the card!\nIs the "
101-
"card correctly inserted?\nIs there a wiring/soldering "
102-
"problem\nIs the config.json file malformed?\nSD CS Pin: " +
103-
String(WsV2.pin_sd_cs)).c_str());
101+
"card correctly inserted?\nIs there a wiring/soldering "
102+
"problem\nIs the config.json file malformed?\nSD CS Pin: " +
103+
String(WsV2.pin_sd_cs))
104+
.c_str());
104105
}
105106

106107
#ifdef USE_DISPLAY
@@ -750,7 +751,7 @@ bool Wippersnapper_V2::generateWSTopics() {
750751
@param error
751752
The error message to write to the serial and filesystem.
752753
*/
753-
void Wippersnapper_V2::errorWriteHangV2(const char* error) {
754+
void Wippersnapper_V2::errorWriteHangV2(const char *error) {
754755
// Print error
755756
WS_DEBUG_PRINTLN(error);
756757
#ifdef USE_TINYUSB
@@ -918,7 +919,8 @@ void Wippersnapper_V2::runNetFSMV2() {
918919
If false, the device will not allow the WDT to bite and
919920
instead hang indefinitely, holding the WIPPER drive open
920921
*/
921-
void Wippersnapper_V2::haltErrorV2(const char* error, ws_led_status_t ledStatusColor,
922+
void Wippersnapper_V2::haltErrorV2(const char *error,
923+
ws_led_status_t ledStatusColor,
922924
bool reboot) {
923925
WS_DEBUG_PRINT("ERROR ");
924926
if (reboot) {

src/Wippersnapper_V2.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
*/
3131
#ifdef WS_DEBUG
3232
#define WS_DEBUG_PRINT(...) \
33-
{ WS_PRINTER.print(__VA_ARGS__); } /**< Print debug message to serial */
33+
{ \
34+
WS_PRINTER.print(__VA_ARGS__); \
35+
} /**< Print debug message to serial */
3436
#define WS_DEBUG_PRINTLN(...) \
3537
{ \
3638
WS_PRINTER.println(__VA_ARGS__); \
@@ -42,9 +44,11 @@
4244
} /**< Print debug message in hexadecimal */
4345
#else
4446
#define WS_DEBUG_PRINT(...) \
45-
{} /**< Debug print */
47+
{ \
48+
} /**< Debug print */
4649
#define WS_DEBUG_PRINTLN(...) \
47-
{} /**< Debug println */
50+
{ \
51+
} /**< Debug println */
4852
#endif
4953

5054
/*!
@@ -67,7 +71,6 @@
6771

6872
// Cpp STD
6973
#include <algorithm>
70-
#include <algorithm>
7174
#include <functional>
7275
#include <map>
7376
#include <string>
@@ -214,10 +217,10 @@ class Wippersnapper_V2 {
214217
void BlinkKATStatus();
215218

216219
// Error handling helpers
217-
void haltErrorV2(const char* error,
220+
void haltErrorV2(const char *error,
218221
ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
219222
bool reboot = true);
220-
void errorWriteHangV2(const char* error);
223+
void errorWriteHangV2(const char *error);
221224

222225
bool _is_offline_mode; ///< Global flag for if the device is in offline mode
223226

@@ -252,7 +255,7 @@ class Wippersnapper_V2 {
252255
nullptr; ///< Instance of Pixels controller
253256
PWMController *_pwm_controller = nullptr; ///< Instance of PWM controller
254257
ServoController *_servo_controller =
255-
nullptr; ///< Instance of Servo controller
258+
nullptr; ///< Instance of Servo controller
256259
UARTController *_uart_controller = nullptr; ///< Instance of UART controller
257260

258261
// TODO: does this really need to be global?

src/components/i2c/controller.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ bool I2cController::PublishI2cDeviceAddedorReplaced(
544544
// If we're in offline mode, don't publish out to IO
545545
if (WsV2._sdCardV2->isModeOffline())
546546
return true; // Back out if we're in offline mode
547-
547+
548548
// Encode the I2cDeviceAddedorReplaced message and publish it to IO
549-
if (!_i2c_model->encodeMsgI2cDeviceAddedorReplaced(
549+
if (!_i2c_model->encodeMsgI2cDeviceAddedorReplaced(
550550
device_descriptor, _i2c_bus_default->GetBusStatus(), device_status)) {
551551
WS_DEBUG_PRINTLN(
552552
"[i2c] ERROR: Unable to encode I2cDeviceAddedorReplaced message!");
@@ -967,7 +967,9 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
967967
WS_DEBUG_PRINTLN("OK!");
968968
} else if (is_gps) {
969969
WS_DEBUG_PRINT("[i2c] Creating a GPS driver...");
970-
if (!WsV2._gps_controller->AddGPS(bus, device_descriptor.i2c_device_address, &_i2c_model->GetI2cDeviceAddOrReplaceMsg()->gps_config)) {
970+
if (!WsV2._gps_controller->AddGPS(
971+
bus, device_descriptor.i2c_device_address,
972+
&_i2c_model->GetI2cDeviceAddOrReplaceMsg()->gps_config)) {
971973
did_init = false;
972974
WS_DEBUG_PRINTLN("FAILURE!");
973975
} else {
@@ -1183,7 +1185,6 @@ bool I2cController::ScanI2cBus(bool default_bus = true) {
11831185
}
11841186
}
11851187

1186-
11871188
/*!
11881189
@brief Enables a MUX channel on the appropriate I2C bus.
11891190
@param mux_channel

src/components/i2c/controller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class I2cController {
105105
uint32_t GetScanDeviceAddress(int index);
106106
size_t GetScanDeviceCount();
107107
void PrintAllDrivers();
108+
108109
private:
109110
I2cModel *_i2c_model = nullptr; ///< Pointer to an I2C model object
110111
I2cOutputModel *_i2c_output_model =

src/components/i2c/drivers/drvBase.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,15 @@ class drvBase {
217217
/*******************************************************************************/
218218
wippersnapper_sensor_SensorType *GetSensorTypes() { return _sensors; }
219219

220+
size_t GetNumSensorTypes() { return _sensors_count; }
220221

221-
size_t GetNumSensorTypes() {
222-
return _sensors_count;
223-
}
224-
225-
/*!
226-
@brief Configures an i2c device's sensors.
227-
@param sensor_types
228-
Pointer to an array of SensorType objects.
229-
@param sensor_types_count
230-
The number of active sensors to read from the device.
231-
*/
222+
/*!
223+
@brief Configures an i2c device's sensors.
224+
@param sensor_types
225+
Pointer to an array of SensorType objects.
226+
@param sensor_types_count
227+
The number of active sensors to read from the device.
228+
*/
232229
void EnableSensorReads(wippersnapper_sensor_SensorType *sensor_types,
233230
size_t sensor_types_count) {
234231
_sensors_count = sensor_types_count;

src/components/uart/drivers/drvUartUs100.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
class UARTDevice {
3333
public:
3434
UARTDevice(Stream *serial) { _serial_dev = serial; }
35-
~UARTDevice() { /* no-op destructor */
36-
}
35+
~UARTDevice() { /* no-op destructor */ }
3736

3837
bool CreateDevice() {
3938
if (_generic_dev != nullptr) {

src/components/uart/model.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,33 @@ class UARTModel {
3232
bool DecodeUartDeviceRemove(pb_istream_t *stream);
3333
wippersnapper_uart_UartAdd *GetUartAddMsg();
3434
// UartAdded
35-
bool EncodeUartAdded(int32_t uart_nbr, wippersnapper_uart_UartDeviceType type, const char *id, bool success);
35+
bool EncodeUartAdded(int32_t uart_nbr, wippersnapper_uart_UartDeviceType type,
36+
const char *id, bool success);
3637
wippersnapper_uart_UartAdded *GetUartAddedMsg();
3738
// UartRemove
3839
wippersnapper_uart_UartRemove *GetUartRemoveMsg();
3940
// UartInputEvent
40-
bool AddUartInputEvent(sensors_event_t &event, wippersnapper_sensor_SensorType sensor_type);
41+
bool AddUartInputEvent(sensors_event_t &event,
42+
wippersnapper_sensor_SensorType sensor_type);
4143
bool EncodeUartInputEvent();
4244
wippersnapper_uart_UartInputEvent *GetUartInputEventMsg();
4345
void ClearUartInputEventMsg();
44-
void ConfigureUartInputEventMsg(uint32_t uart_nbr, wippersnapper_uart_UartDeviceType type, const char *device_id);
46+
void ConfigureUartInputEventMsg(uint32_t uart_nbr,
47+
wippersnapper_uart_UartDeviceType type,
48+
const char *device_id);
49+
4550
private:
46-
wippersnapper_uart_UartAdd _msg_UartAdd; ///< wippersnapper_uart_UartAdd message
47-
wippersnapper_uart_UartAdded _msg_UartAdded; ///< wippersnapper_uart_UartAdded message
48-
wippersnapper_uart_UartRemove _msg_UartRemove; ///< wippersnapper_uart_UartRemove message
49-
wippersnapper_uart_UartWrite _msg_UartWrite; ///< wippersnapper_uart_UartWrite message
50-
wippersnapper_uart_UartWritten _msg_UartWritten; ///< wippersnapper_uart_UartWritten message
51-
wippersnapper_uart_UartInputEvent _msg_UartInputEvent; ///< wippersnapper_uart_UartInputEvent message
51+
wippersnapper_uart_UartAdd
52+
_msg_UartAdd; ///< wippersnapper_uart_UartAdd message
53+
wippersnapper_uart_UartAdded
54+
_msg_UartAdded; ///< wippersnapper_uart_UartAdded message
55+
wippersnapper_uart_UartRemove
56+
_msg_UartRemove; ///< wippersnapper_uart_UartRemove message
57+
wippersnapper_uart_UartWrite
58+
_msg_UartWrite; ///< wippersnapper_uart_UartWrite message
59+
wippersnapper_uart_UartWritten
60+
_msg_UartWritten; ///< wippersnapper_uart_UartWritten message
61+
wippersnapper_uart_UartInputEvent
62+
_msg_UartInputEvent; ///< wippersnapper_uart_UartInputEvent message
5263
};
5364
#endif // WS_UART_MODEL_H

0 commit comments

Comments
 (0)