Skip to content

Commit

Permalink
Configure clang-format for consistent pointer alignment (esphome#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
OttoWinter authored Jun 10, 2021
1 parent 11b8210 commit eb9bd69
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace esphome {
namespace addressable_light {

static const char* TAG = "addressable_light.display";
static const char *TAG = "addressable_light.display";

int AddressableLightDisplay::get_width_internal() { return this->width_; }
int AddressableLightDisplay::get_height_internal() { return this->height_; }
Expand All @@ -24,7 +24,7 @@ void AddressableLightDisplay::update() {
void AddressableLightDisplay::display() {
bool dirty = false;
uint8_t old_r, old_g, old_b, old_w;
Color* c;
Color *c;

for (uint32_t offset = 0; offset < this->addressable_light_buffer_.size(); offset++) {
c = &(this->addressable_light_buffer_[offset]);
Expand Down
10 changes: 5 additions & 5 deletions esphome/components/b_parasite/b_parasite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace esphome {
namespace b_parasite {

static const char* TAG = "b_parasite";
static const char *TAG = "b_parasite";

void BParasite::dump_config() {
ESP_LOGCONFIG(TAG, "b_parasite");
Expand All @@ -16,25 +16,25 @@ void BParasite::dump_config() {
LOG_SENSOR(" ", "Soil Moisture", this->soil_moisture_);
}

bool BParasite::parse_device(const esp32_ble_tracker::ESPBTDevice& device) {
bool BParasite::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
if (device.address_uint64() != address_) {
ESP_LOGVV(TAG, "parse_device(): unknown MAC address.");
return false;
}
ESP_LOGVV(TAG, "parse_device(): MAC address %s found.", device.address_str().c_str());
const auto& service_datas = device.get_service_datas();
const auto &service_datas = device.get_service_datas();
if (service_datas.size() != 1) {
ESP_LOGE(TAG, "Unexpected service_datas size (%d)", service_datas.size());
return false;
}
const auto& service_data = service_datas[0];
const auto &service_data = service_datas[0];

ESP_LOGVV(TAG, "Service data:");
for (const uint8_t byte : service_data.data) {
ESP_LOGVV(TAG, "0x%02x", byte);
}

const auto& data = service_data.data;
const auto &data = service_data.data;

// Counter for deduplicating messages.
uint8_t counter = data[1] & 0x0f;
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/dfplayer/dfplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace esphome {
namespace dfplayer {

static const char* TAG = "dfplayer";
static const char *TAG = "dfplayer";

void DFPlayer::play_folder(uint16_t folder, uint16_t file) {
if (folder < 100 && file < 256) {
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/fingerprint_grow/fingerprint_grow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace esphome {
namespace fingerprint_grow {

static const char* TAG = "fingerprint_grow";
static const char *TAG = "fingerprint_grow";

// Based on Adafruit's library: https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library

Expand Down
8 changes: 4 additions & 4 deletions esphome/components/fujitsu_general/fujitsu_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace fujitsu_general {
#define SET_NIBBLE(message, nibble, value) (message[nibble / 2] |= (value & 0b00001111) << ((nibble % 2) ? 0 : 4))
#define GET_NIBBLE(message, nibble) ((message[nibble / 2] >> ((nibble % 2) ? 0 : 4)) & 0b00001111)

static const char* TAG = "fujitsu_general.climate";
static const char *TAG = "fujitsu_general.climate";

// Common header
const uint8_t FUJITSU_GENERAL_COMMON_LENGTH = 6;
Expand Down Expand Up @@ -202,7 +202,7 @@ void FujitsuGeneralClimate::transmit_off_() {
this->power_ = false;
}

void FujitsuGeneralClimate::transmit_(uint8_t const* message, uint8_t length) {
void FujitsuGeneralClimate::transmit_(uint8_t const *message, uint8_t length) {
ESP_LOGV(TAG, "Transmit message length %d", length);

auto transmit = this->transmitter_->transmit();
Expand Down Expand Up @@ -231,15 +231,15 @@ void FujitsuGeneralClimate::transmit_(uint8_t const* message, uint8_t length) {
transmit.perform();
}

uint8_t FujitsuGeneralClimate::checksum_state_(uint8_t const* message) {
uint8_t FujitsuGeneralClimate::checksum_state_(uint8_t const *message) {
uint8_t checksum = 0;
for (uint8_t i = 7; i < FUJITSU_GENERAL_STATE_MESSAGE_LENGTH - 1; ++i) {
checksum += message[i];
}
return 256 - checksum;
}

uint8_t FujitsuGeneralClimate::checksum_util_(uint8_t const* message) { return 255 - message[5]; }
uint8_t FujitsuGeneralClimate::checksum_util_(uint8_t const *message) { return 255 - message[5]; }

bool FujitsuGeneralClimate::on_receive(remote_base::RemoteReceiveData data) {
ESP_LOGV(TAG, "Received IR message");
Expand Down
6 changes: 3 additions & 3 deletions esphome/components/fujitsu_general/fujitsu_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class FujitsuGeneralClimate : public climate_ir::ClimateIR {
bool on_receive(remote_base::RemoteReceiveData data) override;

/// Transmit message as IR pulses
void transmit_(uint8_t const* message, uint8_t length);
void transmit_(uint8_t const *message, uint8_t length);

/// Calculate checksum for a state message
uint8_t checksum_state_(uint8_t const* message);
uint8_t checksum_state_(uint8_t const *message);

/// Calculate cecksum for a util message
uint8_t checksum_util_(uint8_t const* message);
uint8_t checksum_util_(uint8_t const *message);

// true if currently on - fujitsus transmit an on flag on when the remote moves from off to on
bool power_{false};
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/max31855/max31855.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace esphome {
namespace max31855 {

static const char* TAG = "max31855";
static const char *TAG = "max31855";

void MAX31855Sensor::update() {
this->enable();
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/max31865/max31865.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace esphome {
namespace max31865 {

static const char* TAG = "max31865";
static const char *TAG = "max31865";

void MAX31865Sensor::update() {
// Check new faults since last measurement
Expand Down Expand Up @@ -176,7 +176,7 @@ const uint16_t MAX31865Sensor::read_register_16_(uint8_t reg) {
return value;
}

float MAX31865Sensor::calc_temperature_(const float& rtd_ratio) {
float MAX31865Sensor::calc_temperature_(const float &rtd_ratio) {
// Based loosely on Adafruit's library: https://github.com/adafruit/Adafruit_MAX31865
// Mainly based on formulas provided by Analog:
// http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/max31865/max31865.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MAX31865Sensor : public sensor::Sensor,
void write_register_(uint8_t reg, uint8_t value);
const uint8_t read_register_(uint8_t reg);
const uint16_t read_register_16_(uint8_t reg);
float calc_temperature_(const float& rtd_ratio);
float calc_temperature_(const float &rtd_ratio);
};

} // namespace max31865
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/nfc/ndef_record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace esphome {
namespace nfc {

static const char* TAG = "nfc.ndef_record";
static const char *TAG = "nfc.ndef_record";

uint32_t NdefRecord::get_encoded_size() {
uint32_t size = 2;
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/rtttl/rtttl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace esphome {
namespace rtttl {

static const char* TAG = "rtttl";
static const char *TAG = "rtttl";

static const uint32_t DOUBLE_NOTE_GAP_MS = 10;

Expand Down
Loading

0 comments on commit eb9bd69

Please sign in to comment.