Whitespace cleanup

This commit is contained in:
Scott Lahteine 2020-09-20 18:24:05 -05:00
parent 584a8cd1a8
commit 5a35595a3a
14 changed files with 40 additions and 41 deletions

View File

@ -86,7 +86,7 @@ int RingBuffer::read() {
ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) { ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) {
ring_buffer_pos_t len = available(); ring_buffer_pos_t len = available();
for(ring_buffer_pos_t i = 0; read_index != write_index; i++) { for (ring_buffer_pos_t i = 0; read_index != write_index; i++) {
buffer[i] = data[read_index]; buffer[i] = data[read_index];
read_index = NEXT_INDEX(read_index, size); read_index = NEXT_INDEX(read_index, size);
} }
@ -139,9 +139,8 @@ size_t WebSocketSerial::write(const uint8_t c) {
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) { size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t written = 0; size_t written = 0;
for(size_t i = 0; i < size; i++) { for (size_t i = 0; i < size; i++)
written += write(buffer[i]); written += write(buffer[i]);
}
return written; return written;
} }

View File

@ -155,9 +155,9 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
uint16_t XPT2046::HardwareIO(uint16_t data) { uint16_t XPT2046::HardwareIO(uint16_t data) {
__HAL_SPI_ENABLE(&SPIx); __HAL_SPI_ENABLE(&SPIx);
while((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {} while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
SPIx.Instance->DR = data; SPIx.Instance->DR = data;
while((SPIx.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {} while ((SPIx.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {}
__HAL_SPI_DISABLE(&SPIx); __HAL_SPI_DISABLE(&SPIx);
return SPIx.Instance->DR; return SPIx.Instance->DR;

View File

@ -441,9 +441,9 @@ public:
} }
void dispatch() { void dispatch() {
switch(static_cast<Protocol>(packet.header.protocol())) { switch (static_cast<Protocol>(packet.header.protocol())) {
case Protocol::CONTROL: case Protocol::CONTROL:
switch(static_cast<ProtocolControl>(packet.header.type())) { switch (static_cast<ProtocolControl>(packet.header.type())) {
case ProtocolControl::CLOSE: // revert back to ASCII mode case ProtocolControl::CLOSE: // revert back to ASCII mode
card.flag.binary_mode = false; card.flag.binary_mode = false;
break; break;

View File

@ -74,7 +74,7 @@ void GcodeSuite::M994() {
W25QXX.init(SPI_QUARTER_SPEED); W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BulkErase(); W25QXX.SPI_FLASH_BulkErase();
SERIAL_ECHOPGM("Load SPI Flash"); SERIAL_ECHOPGM("Load SPI Flash");
while(addr < SPI_FLASH_SIZE) { while (addr < SPI_FLASH_SIZE) {
card.read(buf, COUNT(buf)); card.read(buf, COUNT(buf));
W25QXX.SPI_FLASH_BufferWrite(buf, addr, COUNT(buf)); W25QXX.SPI_FLASH_BufferWrite(buf, addr, COUNT(buf));
addr += COUNT(buf); addr += COUNT(buf);

View File

@ -194,7 +194,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
unsigned char temp_Counter; unsigned char temp_Counter;
for (temp_Counter = 0; temp_Counter < LED_NUM; temp_Counter++) { for (temp_Counter = 0; temp_Counter < LED_NUM; temp_Counter++) {
LED_DataArray[temp_Counter] = 0; LED_DataArray[temp_Counter] = 0;
switch(RGB_Scale) { switch (RGB_Scale) {
case RGB_SCALE_R10_G7_B5: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*7/10) << 16 | luminance*5/10; break; case RGB_SCALE_R10_G7_B5: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*7/10) << 16 | luminance*5/10; break;
case RGB_SCALE_R10_G7_B4: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*7/10) << 16 | luminance*4/10; break; case RGB_SCALE_R10_G7_B4: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*7/10) << 16 | luminance*4/10; break;
case RGB_SCALE_R10_G8_B7: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*8/10) << 16 | luminance*7/10; break; case RGB_SCALE_R10_G8_B7: LED_DataArray[temp_Counter] = (luminance*10/10) << 8 | (luminance*8/10) << 16 | luminance*7/10; break;
@ -213,7 +213,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
bool LED_R_Flag = 0, LED_G_Flag = 0, LED_B_Flag = 0; bool LED_R_Flag = 0, LED_G_Flag = 0, LED_B_Flag = 0;
for (temp_Counter = 0; temp_Counter < LED_NUM; temp_Counter++) { for (temp_Counter = 0; temp_Counter < LED_NUM; temp_Counter++) {
switch(RGB_Scale) { switch (RGB_Scale) {
case RGB_SCALE_R10_G7_B5: { case RGB_SCALE_R10_G7_B5: {
LED_R_Data[temp_Counter] = luminance*10/10; LED_R_Data[temp_Counter] = luminance*10/10;
LED_G_Data[temp_Counter] = luminance*7/10; LED_G_Data[temp_Counter] = luminance*7/10;

View File

@ -603,7 +603,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
touch.clear(); touch.clear();
if (calibration_stage < CALIBRATION_SUCCESS) { if (calibration_stage < CALIBRATION_SUCCESS) {
switch(calibration_stage) { switch (calibration_stage) {
case CALIBRATION_POINT_1: tft_string.set("Top Left"); break; case CALIBRATION_POINT_1: tft_string.set("Top Left"); break;
case CALIBRATION_POINT_2: y = TFT_HEIGHT - 21; tft_string.set("Bottom Left"); break; case CALIBRATION_POINT_2: y = TFT_HEIGHT - 21; tft_string.set("Bottom Left"); break;
case CALIBRATION_POINT_3: x = TFT_WIDTH - 21; tft_string.set("Top Right"); break; case CALIBRATION_POINT_3: x = TFT_WIDTH - 21; tft_string.set("Top Right"); break;

View File

@ -608,7 +608,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
touch.clear(); touch.clear();
if (calibration_stage < CALIBRATION_SUCCESS) { if (calibration_stage < CALIBRATION_SUCCESS) {
switch(calibration_stage) { switch (calibration_stage) {
case CALIBRATION_POINT_1: tft_string.set("Top Left"); break; case CALIBRATION_POINT_1: tft_string.set("Top Left"); break;
case CALIBRATION_POINT_2: y = TFT_HEIGHT - 21; tft_string.set("Bottom Left"); break; case CALIBRATION_POINT_2: y = TFT_HEIGHT - 21; tft_string.set("Bottom Left"); break;
case CALIBRATION_POINT_3: x = TFT_WIDTH - 21; tft_string.set("Top Right"); break; case CALIBRATION_POINT_3: x = TFT_WIDTH - 21; tft_string.set("Top Right"); break;