From 295139e249ec340287ba314523149a924d178f92 Mon Sep 17 00:00:00 2001 From: GOB Date: Tue, 13 Aug 2024 13:47:00 +0900 Subject: [PATCH] Cosmetic change --- examples/UnitUnified/Ameter/Ameter.cpp | 8 +++--- examples/UnitUnified/Vmeter/Vmeter.cpp | 8 +++--- src/M5UnitMETER.hpp | 1 - src/unit/unit_ADS1113.hpp | 3 +-- src/unit/unit_ADS1114.cpp | 3 +-- src/unit/unit_ADS1114.hpp | 3 +-- src/unit/unit_ADS1115.cpp | 31 +++++++++-------------- src/unit/unit_ADS1115.hpp | 11 +++----- src/unit/unit_ADS111x.cpp | 18 +++++-------- src/unit/unit_ADS111x.hpp | 22 +++++----------- src/unit/unit_Ameter.hpp | 6 ++--- src/unit/unit_Vmeter.hpp | 8 +++--- test/embedded/avmeter_template.hpp | 21 ++++++--------- test/embedded/embedded_main.cpp | 12 ++++----- test/embedded/test_ameter/ameter_test.cpp | 11 +++----- test/embedded/test_vmeter/vmeter_test.cpp | 11 +++----- 16 files changed, 64 insertions(+), 113 deletions(-) diff --git a/examples/UnitUnified/Ameter/Ameter.cpp b/examples/UnitUnified/Ameter/Ameter.cpp index 7537201..c542b4e 100644 --- a/examples/UnitUnified/Ameter/Ameter.cpp +++ b/examples/UnitUnified/Ameter/Ameter.cpp @@ -50,8 +50,7 @@ void setup() { i2c_cfg.pin_scl = m5::hal::gpio::getPin(pin_num_scl); auto i2c_bus = m5::hal::bus::i2c::getBus(i2c_cfg); M5_LOGI("Bus:%d", i2c_bus.has_value()); - if (!Units.add(unit, i2c_bus ? i2c_bus.value() : nullptr) || - !Units.begin()) { + if (!Units.add(unit, i2c_bus ? i2c_bus.value() : nullptr) || !Units.begin()) { M5_LOGE("Failed to begin"); lcd.clear(TFT_RED); while (true) { @@ -74,9 +73,8 @@ void setup() { M5_LOGI("M5UnitUnified has been begun"); M5_LOGI("%s", Units.debugInfo().c_str()); - M5_LOGI(">RES:%f COEE:%f CF:%f CORR:%f periodic :%d", unit.resolution(), - unit.coefficient(), unit.calibrationFactor(), unit.correction(), - unit.inPeriodic()); + M5_LOGI(">RES:%f COEE:%f CF:%f CORR:%f periodic :%d", unit.resolution(), unit.coefficient(), + unit.calibrationFactor(), unit.correction(), unit.inPeriodic()); lcd.clear(TFT_DARKGREEN); } diff --git a/examples/UnitUnified/Vmeter/Vmeter.cpp b/examples/UnitUnified/Vmeter/Vmeter.cpp index fdfabe0..b7a91e2 100644 --- a/examples/UnitUnified/Vmeter/Vmeter.cpp +++ b/examples/UnitUnified/Vmeter/Vmeter.cpp @@ -51,8 +51,7 @@ void setup() { i2c_cfg.pin_scl = m5::hal::gpio::getPin(pin_num_scl); auto i2c_bus = m5::hal::bus::i2c::getBus(i2c_cfg); M5_LOGI("Bus:%d", i2c_bus.has_value()); - if (!Units.add(unit, i2c_bus ? i2c_bus.value() : nullptr) || - !Units.begin()) { + if (!Units.add(unit, i2c_bus ? i2c_bus.value() : nullptr) || !Units.begin()) { M5_LOGE("Failed to begin"); lcd.clear(TFT_RED); while (true) { @@ -75,9 +74,8 @@ void setup() { M5_LOGI("M5UnitUnified has been begun"); M5_LOGI("%s", Units.debugInfo().c_str()); - M5_LOGI(">RES:%f COEE:%f CF:%f CORR:%f periodic :%d", unit.resolution(), - unit.coefficient(), unit.calibrationFactor(), unit.correction(), - unit.inPeriodic()); + M5_LOGI(">RES:%f COEE:%f CF:%f CORR:%f periodic :%d", unit.resolution(), unit.coefficient(), + unit.calibrationFactor(), unit.correction(), unit.inPeriodic()); lcd.clear(TFT_DARKGREEN); } diff --git a/src/M5UnitMETER.hpp b/src/M5UnitMETER.hpp index 1c369bd..8d32b37 100644 --- a/src/M5UnitMETER.hpp +++ b/src/M5UnitMETER.hpp @@ -28,5 +28,4 @@ namespace m5 { */ namespace unit {} // namespace unit } // namespace m5 - #endif diff --git a/src/unit/unit_ADS1113.hpp b/src/unit/unit_ADS1113.hpp index b71c70c..7c15a8e 100644 --- a/src/unit/unit_ADS1113.hpp +++ b/src/unit/unit_ADS1113.hpp @@ -23,8 +23,7 @@ class UnitADS1113 : public UnitADS111x { M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS1113, 0xFF); public: - explicit UnitADS1113(const uint8_t addr = DEFAULT_ADDRESS) - : UnitADS111x(addr) { + explicit UnitADS1113(const uint8_t addr = DEFAULT_ADDRESS) : UnitADS111x(addr) { } virtual ~UnitADS1113() { } diff --git a/src/unit/unit_ADS1114.cpp b/src/unit/unit_ADS1114.cpp index eb1eb86..228d40b 100644 --- a/src/unit/unit_ADS1114.cpp +++ b/src/unit/unit_ADS1114.cpp @@ -23,8 +23,7 @@ const types::uid_t UnitADS1114::uid{"UnitADS1114"_mmh3}; const types::uid_t UnitADS1114::attr{0}; bool UnitADS1114::on_begin() { M5_LIB_LOGV("mux is not support"); - return setSamplingRate(_cfg.rate) && setGain(_cfg.gain) && - setComparatorQueue(_cfg.comp_que); + return setSamplingRate(_cfg.rate) && setGain(_cfg.gain) && setComparatorQueue(_cfg.comp_que); } } // namespace unit } // namespace m5 diff --git a/src/unit/unit_ADS1114.hpp b/src/unit/unit_ADS1114.hpp index 0386657..87fd7d4 100644 --- a/src/unit/unit_ADS1114.hpp +++ b/src/unit/unit_ADS1114.hpp @@ -22,8 +22,7 @@ class UnitADS1114 : public UnitADS111x { M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS1114, 0xFF); public: - explicit UnitADS1114(const uint8_t addr = DEFAULT_ADDRESS) - : UnitADS111x(addr) { + explicit UnitADS1114(const uint8_t addr = DEFAULT_ADDRESS) : UnitADS111x(addr) { } virtual ~UnitADS1114() { } diff --git a/src/unit/unit_ADS1115.cpp b/src/unit/unit_ADS1115.cpp index 0d2f5df..0c3a09c 100644 --- a/src/unit/unit_ADS1115.cpp +++ b/src/unit/unit_ADS1115.cpp @@ -34,8 +34,7 @@ using namespace m5::unit::ads111x::command; namespace { constexpr Gain gain_table[] = { - Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, - Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, + Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, }; } @@ -46,8 +45,8 @@ const char UnitADS1115::name[] = "UnitADS1115"; const types::uid_t UnitADS1115::uid{"UnitADS1115"_mmh3}; const types::uid_t UnitADS1115::attr{0}; bool UnitADS1115::on_begin() { - return setSamplingRate(_cfg.rate) && setMultiplexer(_cfg.mux) && - setGain(_cfg.gain) && setComparatorQueue(_cfg.comp_que); + return setSamplingRate(_cfg.rate) && setMultiplexer(_cfg.mux) && setGain(_cfg.gain) && + setComparatorQueue(_cfg.comp_que); } // class UnitADS1115WithEEPROM @@ -78,13 +77,11 @@ bool UnitADS1115WithEEPROM::assign(TwoWire& wire) { bool UnitADS1115WithEEPROM::on_begin() { int idx{}; for (auto&& e : gain_table) { - if (!read_calibration(e, _calibration[idx].hope, - _calibration[idx].actual)) { + if (!read_calibration(e, _calibration[idx].hope, _calibration[idx].actual)) { M5_LIB_LOGE("Failed ti read calibration data"); return false; } - M5_LIB_LOGV("Calibration[%u]: %d,%d", e, _calibration[idx].hope, - _calibration[idx].actual); + M5_LIB_LOGV("Calibration[%u]: %d,%d", e, _calibration[idx].hope, _calibration[idx].actual); ++idx; } apply_calibration(_adsCfg.pga()); @@ -99,18 +96,15 @@ bool UnitADS1115WithEEPROM::setGain(const ads111x::Gain gain) { return false; } -bool UnitADS1115WithEEPROM::read_calibration(const Gain gain, int16_t& hope, - int16_t& actual) { +bool UnitADS1115WithEEPROM::read_calibration(const Gain gain, int16_t& hope, int16_t& actual) { uint8_t reg = 0xD0 + m5::stl::to_underlying(gain) * 8; uint8_t buf[8]{}; - if (_adapterEEPROM->writeWithTransaction(reg, nullptr, 0U) != - m5::hal::error::error_t::OK) { + if (_adapterEEPROM->writeWithTransaction(reg, nullptr, 0U) != m5::hal::error::error_t::OK) { M5_LIB_LOGE("Failed to write"); return false; } - if (_adapterEEPROM->readWithTransaction(buf, sizeof(buf)) != - m5::hal::error::error_t::OK) { + if (_adapterEEPROM->readWithTransaction(buf, sizeof(buf)) != m5::hal::error::error_t::OK) { return false; } @@ -131,11 +125,10 @@ bool UnitADS1115WithEEPROM::read_calibration(const Gain gain, int16_t& hope, } void UnitADS1115WithEEPROM::apply_calibration(const Gain gain) { - auto idx = m5::stl::to_underlying(gain); - _calibrationFactor = - (idx < m5::stl::size(_calibration) && _calibration[idx].actual) - ? (float)_calibration[idx].hope / _calibration[idx].actual - : 1.0f; + auto idx = m5::stl::to_underlying(gain); + _calibrationFactor = (idx < m5::stl::size(_calibration) && _calibration[idx].actual) + ? (float)_calibration[idx].hope / _calibration[idx].actual + : 1.0f; } } // namespace unit diff --git a/src/unit/unit_ADS1115.hpp b/src/unit/unit_ADS1115.hpp index f7add05..8e6b19c 100644 --- a/src/unit/unit_ADS1115.hpp +++ b/src/unit/unit_ADS1115.hpp @@ -23,8 +23,7 @@ class UnitADS1115 : public UnitADS111x { M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS1115, 0x00); public: - explicit UnitADS1115(const uint8_t addr = DEFAULT_ADDRESS) - : UnitADS111x(addr) { + explicit UnitADS1115(const uint8_t addr = DEFAULT_ADDRESS) : UnitADS111x(addr) { } virtual ~UnitADS1115() { } @@ -74,9 +73,8 @@ class UnitADS1115WithEEPROM : public UnitADS1115 { public: constexpr static uint8_t DEFAULT_EEPROM_ADDRESS{0xFF}; - explicit UnitADS1115WithEEPROM( - const uint8_t addr = DEFAULT_ADDRESS, - const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) + explicit UnitADS1115WithEEPROM(const uint8_t addr = DEFAULT_ADDRESS, + const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) : UnitADS1115(addr), _eepromAddr(epromAddr) { } virtual ~UnitADS1115WithEEPROM() { @@ -94,8 +92,7 @@ class UnitADS1115WithEEPROM : public UnitADS1115 { protected: virtual bool on_begin() override; - bool read_calibration(const ads111x::Gain gain, int16_t& hope, - int16_t& actual); + bool read_calibration(const ads111x::Gain gain, int16_t& hope, int16_t& actual); void apply_calibration(const ads111x::Gain gain); protected: diff --git a/src/unit/unit_ADS111x.cpp b/src/unit/unit_ADS111x.cpp index 6bedce8..7b04969 100644 --- a/src/unit/unit_ADS111x.cpp +++ b/src/unit/unit_ADS111x.cpp @@ -17,8 +17,7 @@ using namespace m5::unit::ads111x::command; namespace { constexpr elapsed_time_t interval_table[] = { - 1000UL / 8, 1000UL / 16, 1000UL / 32, 1000UL / 64, - 1000UL / 128, 1000UL / 250, 1000UL / 475, 1000UL / 860, + 1000UL / 8, 1000UL / 16, 1000UL / 32, 1000UL / 64, 1000UL / 128, 1000UL / 250, 1000UL / 475, 1000UL / 860, }; constexpr float coefficient_table[] = { @@ -83,8 +82,7 @@ bool UnitADS111x::begin() { apply_interval(_adsCfg.dr()); apply_coefficient(_adsCfg.pga()); - return _cfg.start_periodic ? startPeriodicMeasurement() - : stopPeriodicMeasurement(); + return _cfg.start_periodic ? startPeriodicMeasurement() : stopPeriodicMeasurement(); } void UnitADS111x::update(const bool force) { @@ -138,8 +136,7 @@ bool UnitADS111x::start_periodic_measurement() { } bool UnitADS111x::start_periodic_measurement(const ads111x::Sampling rate) { - return !inPeriodic() && setSamplingRate(rate) && - start_periodic_measurement(); + return !inPeriodic() && setSamplingRate(rate) && start_periodic_measurement(); } bool UnitADS111x::stop_periodic_measurement() { @@ -154,8 +151,7 @@ bool UnitADS111x::stop_periodic_measurement() { return false; } -bool UnitADS111x::measureSingleshot(ads111x::Data& d, - const uint32_t timeoutMillis) { +bool UnitADS111x::measureSingleshot(ads111x::Data& d, const uint32_t timeoutMillis) { if (inPeriodic()) { M5_LIB_LOGW("Periodic measurements are running"); return false; @@ -228,8 +224,7 @@ bool UnitADS111x::generalReset() { bool UnitADS111x::readThreshould(int16_t& high, int16_t& low) { uint16_t hh{}, ll{}; - if (readRegister16(HIGH_THRESHOLD_REG, hh, 0) && - readRegister16(LOW_THRESHOLD_REG, ll, 0)) { + if (readRegister16(HIGH_THRESHOLD_REG, hh, 0) && readRegister16(LOW_THRESHOLD_REG, ll, 0)) { high = hh; low = ll; return true; @@ -242,8 +237,7 @@ bool UnitADS111x::setThreshould(const int16_t high, const int16_t low) { M5_LIB_LOGW("high must be greater than low"); return false; } - return writeRegister16(HIGH_THRESHOLD_REG, (uint16_t)high) && - writeRegister16(LOW_THRESHOLD_REG, (uint16_t)low); + return writeRegister16(HIGH_THRESHOLD_REG, (uint16_t)high) && writeRegister16(LOW_THRESHOLD_REG, (uint16_t)low); } // diff --git a/src/unit/unit_ADS111x.hpp b/src/unit/unit_ADS111x.hpp index 5a22e77..d0de170 100644 --- a/src/unit/unit_ADS111x.hpp +++ b/src/unit/unit_ADS111x.hpp @@ -152,19 +152,16 @@ struct Config { value = (value & ~(1U << 15)) | ((b ? 1U : 0) << 15); } inline void mux(const Mux m) { - value = (value & ~(0x07 << 12)) | - ((m5::stl::to_underlying(m) & 0x07) << 12); + value = (value & ~(0x07 << 12)) | ((m5::stl::to_underlying(m) & 0x07) << 12); } inline void pga(const Gain g) { - value = - (value & ~(0x07 << 9)) | ((m5::stl::to_underlying(g) & 0x07) << 9); + value = (value & ~(0x07 << 9)) | ((m5::stl::to_underlying(g) & 0x07) << 9); } inline void mode(const bool b) { value = (value & ~(1U << 8)) | ((b ? 1U : 0) << 8); } inline void dr(const Sampling r) { - value = - (value & ~(0x07 << 5)) | ((m5::stl::to_underlying(r) & 0x07) << 5); + value = (value & ~(0x07 << 5)) | ((m5::stl::to_underlying(r) & 0x07) << 5); } inline void comp_mode(const bool b) { value = (value & ~(1U << 4)) | ((b ? 1U : 0) << 4); @@ -201,9 +198,7 @@ struct Data { @class UnitADS111x @brief Base class for ADS111x series */ -class UnitADS111x - : public Component, - public PeriodicMeasurementAdapter { +class UnitADS111x : public Component, public PeriodicMeasurementAdapter { M5_UNIT_COMPONENT_HPP_BUILDER(UnitADS111x, 0x00); public: @@ -221,8 +216,7 @@ class UnitADS111x }; explicit UnitADS111x(const uint8_t addr = DEFAULT_ADDRESS) - : Component(addr), - _data{new m5::container::CircularBuffer(1)} { + : Component(addr), _data{new m5::container::CircularBuffer(1)} { } virtual ~UnitADS111x() { } @@ -336,8 +330,7 @@ class UnitADS111x @warning Until it can be measured, it will be blocked until the timeout time */ - bool measureSingleshot(ads111x::Data& d, - const uint32_t timeoutMillis = 1000); + bool measureSingleshot(ads111x::Data& d, const uint32_t timeoutMillis = 1000); ///@} ///@name Threshold @@ -409,8 +402,7 @@ class UnitADS111x bool set_latching_comparator(const bool b); bool set_comparator_queue(const ads111x::ComparatorQueue c); - M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER(UnitADS111x, - ads111x::Data); + M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER(UnitADS111x, ads111x::Data); protected: std::unique_ptr> _data{}; diff --git a/src/unit/unit_Ameter.hpp b/src/unit/unit_Ameter.hpp index 392bd17..5619b16 100644 --- a/src/unit/unit_Ameter.hpp +++ b/src/unit/unit_Ameter.hpp @@ -28,8 +28,7 @@ class UnitAmeter : public UnitADS1115WithEEPROM { constexpr static uint8_t DEFAULT_EEPROM_ADDRESS{0x51}; constexpr static float PRESSURE_COEFFICIENT{0.05f}; - explicit UnitAmeter(const uint8_t addr = DEFAULT_ADDRESS, - const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) + explicit UnitAmeter(const uint8_t addr = DEFAULT_ADDRESS, const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) : UnitADS1115WithEEPROM(addr, epromAddr) { } virtual ~UnitAmeter() { @@ -45,8 +44,7 @@ class UnitAmeter : public UnitADS1115WithEEPROM { } //! @brief Oldest current inline float current() const { - return !empty() ? correction() * std::abs(adc()) - : std::numeric_limits::quiet_NaN(); + return !empty() ? correction() * std::abs(adc()) : std::numeric_limits::quiet_NaN(); } protected: diff --git a/src/unit/unit_Vmeter.hpp b/src/unit/unit_Vmeter.hpp index 0516e16..d2b6695 100644 --- a/src/unit/unit_Vmeter.hpp +++ b/src/unit/unit_Vmeter.hpp @@ -27,8 +27,7 @@ class UnitVmeter : public UnitADS1115WithEEPROM { constexpr static uint8_t DEFAULT_EEPROM_ADDRESS{0x53}; constexpr static float PRESSURE_COEFFICIENT{0.01591895f}; - explicit UnitVmeter(const uint8_t addr = DEFAULT_ADDRESS, - const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) + explicit UnitVmeter(const uint8_t addr = DEFAULT_ADDRESS, const uint8_t epromAddr = DEFAULT_EEPROM_ADDRESS) : UnitADS1115WithEEPROM(addr, epromAddr) { } @@ -47,10 +46,9 @@ class UnitVmeter : public UnitADS1115WithEEPROM { //! @brief Oldest voltage inline float voltage() const { - return !empty() ? correction() * std::abs(adc()) - : std::numeric_limits::quiet_NaN(); + return !empty() ? correction() * std::abs(adc()) : std::numeric_limits::quiet_NaN(); } - + protected: virtual void apply_coefficient(const ads111x::Gain gain) override; diff --git a/test/embedded/avmeter_template.hpp b/test/embedded/avmeter_template.hpp index d549042..4f37aa2 100644 --- a/test/embedded/avmeter_template.hpp +++ b/test/embedded/avmeter_template.hpp @@ -28,12 +28,11 @@ using namespace m5::unit::googletest; using namespace m5::unit; using namespace m5::unit::ads111x; -class TestADS1115 - : public ComponentTestBase { +class TestADS1115 : public ComponentTestBase { protected: virtual UnitADS1115WithEEPROM* get_instance() override { TestParams tp = GetParam(); - auto ptr = new m5::unit::UnitADS1115WithEEPROM(tp.reg, tp.reg_eeprom); + auto ptr = new m5::unit::UnitADS1115WithEEPROM(tp.reg, tp.reg_eeprom); if (ptr) { auto cfg = ptr->config(); cfg.stored_size = 4; @@ -97,8 +96,7 @@ TEST_P(TestADS1115, Configration) { uint16_t prev{}, now{}; { constexpr Mux mux_table[] = { - Mux::GND_0, Mux::GND_1, Mux::GND_2, Mux::GND_3, - Mux::AIN_01, Mux::AIN_03, Mux::AIN_13, Mux::AIN_23, + Mux::GND_0, Mux::GND_1, Mux::GND_2, Mux::GND_3, Mux::AIN_01, Mux::AIN_03, Mux::AIN_13, Mux::AIN_23, }; SCOPED_TRACE("Mux"); @@ -117,8 +115,7 @@ TEST_P(TestADS1115, Configration) { { constexpr Gain gain_table[] = { - Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, - Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, + Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, }; SCOPED_TRACE("Gain"); @@ -164,9 +161,8 @@ TEST_P(TestADS1115, Configration) { { constexpr Sampling rate_table[] = { - Sampling::Rate8, Sampling::Rate16, Sampling::Rate32, - Sampling::Rate64, Sampling::Rate128, Sampling::Rate250, - Sampling::Rate475, Sampling::Rate860, + Sampling::Rate8, Sampling::Rate16, Sampling::Rate32, Sampling::Rate64, + Sampling::Rate128, Sampling::Rate250, Sampling::Rate475, Sampling::Rate860, }; SCOPED_TRACE("Rate"); @@ -256,9 +252,8 @@ TEST_P(TestADS1115, Periodic) { SCOPED_TRACE(ustr); std::tuple table[] = { - {"8sps", Sampling::Rate8}, {"16sps", Sampling::Rate16}, - {"32sps", Sampling::Rate32}, {"64sps", Sampling::Rate64}, - {"128sps", Sampling::Rate128}, {"250sps", Sampling::Rate250}, + {"8sps", Sampling::Rate8}, {"16sps", Sampling::Rate16}, {"32sps", Sampling::Rate32}, + {"64sps", Sampling::Rate64}, {"128sps", Sampling::Rate128}, {"250sps", Sampling::Rate250}, {"475sps", Sampling::Rate475}, {"860sps", Sampling::Rate860}, }; diff --git a/test/embedded/embedded_main.cpp b/test/embedded/embedded_main.cpp index a17c0d7..f8f695e 100644 --- a/test/embedded/embedded_main.cpp +++ b/test/embedded/embedded_main.cpp @@ -15,9 +15,8 @@ #if __has_include() #include #else // esp_idf_version.h has been introduced in Arduino 1.0.5 (ESP-IDF3.3) -#define ESP_IDF_VERSION_VAL(major, minor, patch) \ - ((major << 16) | (minor << 8) | (patch)) -#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(3, 2, 0) +#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) +#define ESP_IDF_VERSION ESP_IDF_VERSION_VAL(3, 2, 0) #endif namespace { @@ -25,8 +24,7 @@ auto& lcd = M5.Display; } // namespace void test() { - lcd.fillRect(0, 0, lcd.width() >> 1, lcd.height(), - RUN_ALL_TESTS() ? TFT_RED : TFT_GREEN); + lcd.fillRect(0, 0, lcd.width() >> 1, lcd.height(), RUN_ALL_TESTS() ? TFT_RED : TFT_GREEN); } void setup() { @@ -35,8 +33,8 @@ void setup() { M5.begin(); M5_LOGI("CPP %ld", __cplusplus); - M5_LOGI("ESP-IDF Version %d.%d.%d", (ESP_IDF_VERSION >> 16) & 0xFF, - (ESP_IDF_VERSION >> 8) & 0xFF, ESP_IDF_VERSION & 0xFF); + M5_LOGI("ESP-IDF Version %d.%d.%d", (ESP_IDF_VERSION >> 16) & 0xFF, (ESP_IDF_VERSION >> 8) & 0xFF, + ESP_IDF_VERSION & 0xFF); M5_LOGI("BOARD:%X", M5.getBoard()); M5_LOGI("Heap: %u", esp_get_free_heap_size()); diff --git a/test/embedded/test_ameter/ameter_test.cpp b/test/embedded/test_ameter/ameter_test.cpp index c949e96..be0eea2 100644 --- a/test/embedded/test_ameter/ameter_test.cpp +++ b/test/embedded/test_ameter/ameter_test.cpp @@ -13,8 +13,7 @@ using namespace m5::unit; using namespace m5::unit::googletest; using namespace m5::unit::ads111x; -const ::testing::Environment* global_fixture = - ::testing::AddGlobalTestEnvironment(new GlobalFixture<400000U>()); +const ::testing::Environment* global_fixture = ::testing::AddGlobalTestEnvironment(new GlobalFixture<400000U>()); #if 0 INSTANTIATE_TEST_SUITE_P( @@ -25,9 +24,8 @@ INSTANTIATE_TEST_SUITE_P( +UnitAmeter::DEFAULT_EEPROM_ADDRESS})); #endif INSTANTIATE_TEST_SUITE_P(ParamValues, TestADS1115, - ::testing::Values(TestParams{ - false, +UnitAmeter::DEFAULT_ADDRESS, - +UnitAmeter::DEFAULT_EEPROM_ADDRESS})); + ::testing::Values(TestParams{false, +UnitAmeter::DEFAULT_ADDRESS, + +UnitAmeter::DEFAULT_EEPROM_ADDRESS})); // For UnitAmeter-specific testing class TestAmeter : public ComponentTestBase { @@ -52,8 +50,7 @@ INSTANTIATE_TEST_SUITE_P(ParamValues, TestAmeter, ::testing::Values(false)); TEST_P(TestAmeter, Correction) { constexpr Gain gain_table[] = { - Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, - Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, + Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, }; float prev = unit->correction(); diff --git a/test/embedded/test_vmeter/vmeter_test.cpp b/test/embedded/test_vmeter/vmeter_test.cpp index 838e2f9..d7bc88e 100644 --- a/test/embedded/test_vmeter/vmeter_test.cpp +++ b/test/embedded/test_vmeter/vmeter_test.cpp @@ -9,8 +9,7 @@ #include "../avmeter_template.hpp" #include -const ::testing::Environment* global_fixture = - ::testing::AddGlobalTestEnvironment(new GlobalFixture<400000U>()); +const ::testing::Environment* global_fixture = ::testing::AddGlobalTestEnvironment(new GlobalFixture<400000U>()); #if 0 INSTANTIATE_TEST_SUITE_P( @@ -21,9 +20,8 @@ INSTANTIATE_TEST_SUITE_P( +UnitVmeter::DEFAULT_EEPROM_ADDRESS})); #endif INSTANTIATE_TEST_SUITE_P(ParamValues, TestADS1115, - ::testing::Values(TestParams{ - false, +UnitVmeter::DEFAULT_ADDRESS, - +UnitVmeter::DEFAULT_EEPROM_ADDRESS})); + ::testing::Values(TestParams{false, +UnitVmeter::DEFAULT_ADDRESS, + +UnitVmeter::DEFAULT_EEPROM_ADDRESS})); // For UnitVmeter-specific testing class TestVmeter : public ComponentTestBase { @@ -48,8 +46,7 @@ INSTANTIATE_TEST_SUITE_P(ParamValues, TestVmeter, ::testing::Values(false)); TEST_P(TestVmeter, Correction) { constexpr Gain gain_table[] = { - Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, - Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, + Gain::PGA_6144, Gain::PGA_4096, Gain::PGA_2048, Gain::PGA_1024, Gain::PGA_512, Gain::PGA_256, }; float prev = unit->correction();