1
0
forked from me/IronOS

Add Core/Drivers to the scope of style check by clang-format (#1754)

* clang-format: add ./Core/Drivers (except usb-pd) to the scope of style check

* Fix missed suggestion

---------

Co-authored-by: discip <53649486+discip@users.noreply.github.com>
Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>
This commit is contained in:
Ivan Zorin
2023-07-28 12:39:01 +03:00
committed by GitHub
parent ea1906e499
commit 65ac2e25a6
5 changed files with 58 additions and 41 deletions

View File

@@ -215,6 +215,6 @@ uint8_t hub238_source_currentX100() {
temp &= 0b1111;
return pdo_slot_to_currentx100(temp);
}
return 10;//Failsafe to 0.1 amp
return 10; // Failsafe to 0.1 amp
}
#endif

View File

@@ -547,8 +547,9 @@ void OLED::printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, boo
}
buffer[0] = 2 + number % 10;
if (noLeaderZeros)
if (noLeaderZeros) {
stripLeaderZeros(buffer, places);
}
print(buffer, fontStyle);
}
@@ -574,10 +575,12 @@ void OLED::drawSymbol(uint8_t symbolID) {
// Draw an area, but y must be aligned on 0/8 offset
void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr) {
// Splat this from x->x+wide in two strides
if (x <= -wide)
if (x <= -wide) {
return; // cutoffleft
if (x > 96)
}
if (x > 96) {
return; // cutoff right
}
uint8_t visibleStart = 0;
uint8_t visibleEnd = wide;
@@ -609,10 +612,12 @@ void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uin
// For data which has octets swapped in a 16-bit word.
void OLED::drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr) {
// Splat this from x->x+wide in two strides
if (x <= -wide)
if (x <= -wide) {
return; // cutoffleft
if (x > 96)
}
if (x > 96) {
return; // cutoff right
}
uint8_t visibleStart = 0;
uint8_t visibleEnd = wide;
@@ -643,10 +648,12 @@ void OLED::drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, co
void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t value) {
// Splat this from x->x+wide in two strides
if (x <= -wide)
if (x <= -wide) {
return; // cutoffleft
if (x > 96)
}
if (x > 96) {
return; // cutoff right
}
uint8_t visibleStart = 0;
uint8_t visibleEnd = wide;
@@ -682,30 +689,37 @@ void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool c
uint8_t mask = 0xFF;
if (y0) {
mask = mask << (y0 % 8);
for (uint8_t col = x0; col < x1; col++)
if (clear)
for (uint8_t col = x0; col < x1; col++) {
if (clear) {
stripPointers[0][(y0 / 8) * 96 + col] &= ~mask;
else
} else {
stripPointers[0][(y0 / 8) * 96 + col] |= mask;
}
}
}
// Next loop down the line the total number of solids
if (y0 / 8 != y1 / 8)
for (uint8_t col = x0; col < x1; col++)
if (y0 / 8 != y1 / 8) {
for (uint8_t col = x0; col < x1; col++) {
for (uint8_t r = (y0 / 8); r < (y1 / 8); r++) {
// This gives us the row index r
if (clear)
if (clear) {
stripPointers[0][(r * 96) + col] = 0;
else
} else {
stripPointers[0][(r * 96) + col] = 0xFF;
}
}
}
}
// Finally draw the tail
mask = ~(mask << (y1 % 8));
for (uint8_t col = x0; col < x1; col++)
if (clear)
for (uint8_t col = x0; col < x1; col++) {
if (clear) {
stripPointers[0][(y1 / 8) * 96 + col] &= ~mask;
else
} else {
stripPointers[0][(y1 / 8) * 96 + col] |= mask;
}
}
}
void OLED::drawHeatSymbol(uint8_t state) {

View File

@@ -44,11 +44,12 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool ski
if (getSettingValue(SettingsOptions::CalibrationOffset) && skipCalOffset == false) {
// Remove uV tipOffset
if (valueuV > getSettingValue(SettingsOptions::CalibrationOffset))
if (valueuV > getSettingValue(SettingsOptions::CalibrationOffset)) {
valueuV -= getSettingValue(SettingsOptions::CalibrationOffset);
else
} else {
valueuV = 0;
}
}
lastuv = valueuV;
return valueuV;
}
@@ -78,8 +79,9 @@ uint32_t TipThermoModel::getTipInC(bool sampleNow) {
// I found a number that doesn't unbalance the existing PID, causing overshoot.
// This could be tuned in concert with PID parameters...
if (currentTipTempInC < 0)
if (currentTipTempInC < 0) {
return 0;
}
return currentTipTempInC;
}

View File

@@ -93,19 +93,23 @@ uint32_t *USBPowerDelivery::getLastSeenCapabilities() { return lastCapabilities;
static unsigned int sqrtI(unsigned long sqrtArg) {
unsigned int answer, x;
unsigned long temp;
if (sqrtArg == 0)
if (sqrtArg == 0) {
return 0; // undefined result
if (sqrtArg == 1)
}
if (sqrtArg == 1) {
return 1; // identity
}
answer = 0; // integer square root
for (x = 0x8000; x > 0; x = x >> 1) { // 16 bit shift
answer |= x; // possible bit in root
temp = answer * answer; //
if (temp == sqrtArg)
if (temp == sqrtArg) {
break; // exact, found it
if (temp > sqrtArg)
}
if (temp > sqrtArg) {
answer ^= x; // too large, reverse bit
}
}
return answer; // approximate root
}
#endif
@@ -225,7 +229,6 @@ bool EPREvaluateCapabilityFunc(const epr_pd_msg *capabilities, pd_msg *request)
request->hdr = PD_MSGTYPE_EPR_REQUEST | PD_NUMOBJ(2);
request->obj[1] = lastCapabilities[bestIndex]; // Copy PDO into slot 2
if (bestIsAVS) {
request->obj[0] = PD_RDO_PROG_CURRENT_SET(PD_CA2PAI(bestIndexCurrent)) | PD_RDO_PROG_VOLTAGE_SET(PD_MV2APS(bestIndexVoltage));
} else if (bestIsPPS) {

View File

@@ -178,7 +178,6 @@ PD_DRIVER_DIR=./Core/Drivers/usb-pd
ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \
-o -path $(PD_DRIVER_DIR) \
-o -path $(PINECILV2_SDK_DIR) \
-o -path $(DRIVER_INC_DIR) \
-o -path $(MINIWARE_HAL_INC_DIR) \
-o -path $(S60_HAL_INC_DIR) \
-o -path $(MHP30_HAL_INC_DIR) \
@@ -193,7 +192,6 @@ ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \
ALL_SOURCE_EXCEPT:=-path $(SOURCE_BRIEFLZ_DIR) \
-o -path $(PD_DRIVER_DIR) \
-o -path $(PINECILV2_SDK_DIR) \
-o -path $(SOURCE_DRIVERS_DIR) \
-o -path $(MINIWARE_HAL_SRC_DIR) \
-o -path $(S60_HAL_SRC_DIR) \
-o -path $(MHP30_HAL_SRC_DIR) \