💡 Misc. cleanup, comments

This commit is contained in:
Scott Lahteine 2022-01-12 09:47:22 -06:00
parent 89f1391306
commit 24d1d3eb5c
12 changed files with 30 additions and 33 deletions

View file

@ -139,7 +139,7 @@ inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255,
// Enable hooks into idle and setup for HAL // Enable hooks into idle and setup for HAL
#define HAL_IDLETASK 1 #define HAL_IDLETASK 1
#define BOARD_INIT() HAL_init_board(); #define BOARD_INIT() HAL_init_board()
void HAL_idletask(); void HAL_idletask();
inline void HAL_init() {} inline void HAL_init() {}
void HAL_init_board(); void HAL_init_board();

View file

@ -41,7 +41,7 @@
* *
* If XYZE are not given, default restore uses the smart blocking move. * If XYZE are not given, default restore uses the smart blocking move.
*/ */
void GcodeSuite::G61(void) { void GcodeSuite::G61() {
const uint8_t slot = parser.byteval('S'); const uint8_t slot = parser.byteval('S');

View file

@ -45,7 +45,7 @@
#include <string.h> #include <string.h>
int lcd_glyph_height(void) { return 1; } int lcd_glyph_height() { return 1; }
typedef struct _TFTGLCD_charmap_t { typedef struct _TFTGLCD_charmap_t {
wchar_t uchar; // the unicode char wchar_t uchar; // the unicode char
@ -1119,7 +1119,7 @@ int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) {
return 0; return 0;
} }
int test_TFTGLCD_charmap_all(void) { int test_TFTGLCD_charmap_all() {
int flg_error = 0; int flg_error = 0;
if (test_TFTGLCD_charmap(g_TFTGLCD_charmap_device, COUNT(g_TFTGLCD_charmap_device), "g_TFTGLCD_charmap_device", 0) < 0) { if (test_TFTGLCD_charmap(g_TFTGLCD_charmap_device, COUNT(g_TFTGLCD_charmap_device), "g_TFTGLCD_charmap_device", 0) < 0) {
flg_error = 1; flg_error = 1;

View file

@ -265,7 +265,7 @@ void TFTGLCD::setContrast(uint16_t contrast) {
extern volatile int8_t encoderDiff; extern volatile int8_t encoderDiff;
// Read buttons and encoder states // Read buttons and encoder states
uint8_t MarlinUI::read_slow_buttons(void) { uint8_t MarlinUI::read_slow_buttons() {
if (!PanelDetected) return 0; if (!PanelDetected) return 0;
#if ENABLED(TFTGLCD_PANEL_SPI) #if ENABLED(TFTGLCD_PANEL_SPI)
uint8_t b = 0; uint8_t b = 0;

View file

@ -57,7 +57,7 @@
#include "../../feature/cooler.h" #include "../../feature/cooler.h"
#endif #endif
#if ENABLED(I2C_AMMETER) #if DO_DRAW_AMMETER
#include "../../feature/ammeter.h" #include "../../feature/ammeter.h"
#endif #endif

View file

@ -63,7 +63,7 @@ char AnycubicTFTClass::SelectedDirectory[30];
char AnycubicTFTClass::SelectedFile[FILENAME_LENGTH]; char AnycubicTFTClass::SelectedFile[FILENAME_LENGTH];
// Serial helpers // Serial helpers
static void sendNewLine(void) { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); } static void sendNewLine() { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); }
static void send(const char *str) { LCD_SERIAL.print(str); } static void send(const char *str) { LCD_SERIAL.print(str); }
static void send_P(PGM_P str) { static void send_P(PGM_P str) {
while (const char c = pgm_read_byte(str++)) while (const char c = pgm_read_byte(str++))

View file

@ -1459,7 +1459,7 @@ void DGUSScreenHandler::LanguagePInit() {
} }
} }
void DGUSScreenHandler::DGUS_ExtrudeLoadInit(void) { void DGUSScreenHandler::DGUS_ExtrudeLoadInit() {
ex_filament.ex_length = distanceFilament; ex_filament.ex_length = distanceFilament;
ex_filament.ex_load_unload_flag = 0; ex_filament.ex_load_unload_flag = 0;
ex_filament.ex_need_time = filamentSpeed_mm_s; ex_filament.ex_need_time = filamentSpeed_mm_s;
@ -1469,7 +1469,7 @@ void DGUSScreenHandler::DGUS_ExtrudeLoadInit(void) {
ex_filament.ex_tick_start = 0; ex_filament.ex_tick_start = 0;
} }
void DGUSScreenHandler::DGUS_RunoutInit(void) { void DGUSScreenHandler::DGUS_RunoutInit() {
#if PIN_EXISTS(MT_DET_1) #if PIN_EXISTS(MT_DET_1)
SET_INPUT_PULLUP(MT_DET_1_PIN); SET_INPUT_PULLUP(MT_DET_1_PIN);
#endif #endif
@ -1479,7 +1479,7 @@ void DGUSScreenHandler::DGUS_RunoutInit(void) {
runout_mks.runout_status = UNRUNOUT_STATUS; runout_mks.runout_status = UNRUNOUT_STATUS;
} }
void DGUSScreenHandler::DGUS_Runout_Idle(void) { void DGUSScreenHandler::DGUS_Runout_Idle() {
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR) #if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
// scanf runout pin // scanf runout pin
switch (runout_mks.runout_status) { switch (runout_mks.runout_status) {

View file

@ -94,10 +94,10 @@ public:
static void DGUS_LanguageDisplay(uint8_t var); static void DGUS_LanguageDisplay(uint8_t var);
static void TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr); static void TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr);
static void GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr); static void GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr);
static void LanguagePInit(void); static void LanguagePInit();
static void DGUS_Runout_Idle(void); static void DGUS_Runout_Idle();
static void DGUS_RunoutInit(void); static void DGUS_RunoutInit();
static void DGUS_ExtrudeLoadInit(void); static void DGUS_ExtrudeLoadInit();
static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr); static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr);
static void SD_FileBack(DGUS_VP_Variable &var, void *val_ptr); static void SD_FileBack(DGUS_VP_Variable &var, void *val_ptr);

View file

@ -313,7 +313,7 @@ void DGUSDisplay::ProcessRx() {
gcode.reset_stepper_timeout(); gcode.reset_stepper_timeout();
if (!vp.size) { if (!vp.size) {
DEBUG_ECHOLN(); DEBUG_EOL();
vp.rx_handler(vp, nullptr); vp.rx_handler(vp, nullptr);
rx_datagram_state = DGUS_IDLE; rx_datagram_state = DGUS_IDLE;
@ -325,18 +325,15 @@ void DGUSDisplay::ProcessRx() {
memset(buffer, 0, vp.size); memset(buffer, 0, vp.size);
for (uint8_t i = 0; i < dlen; i++) { for (uint8_t i = 0; i < dlen; i++) {
if (i >= vp.size) { if (i >= vp.size) break;
break;
}
if (i + 1 < dlen && tmp[i + 3] == 0xFF && tmp[i + 4] == 0xFF) { if (i + 1 < dlen && tmp[i + 3] == 0xFF && tmp[i + 4] == 0xFF)
break; break;
}
buffer[i] = tmp[i + 3]; buffer[i] = tmp[i + 3];
} }
DEBUG_ECHOLN(); DEBUG_EOL();
vp.rx_handler(vp, buffer); vp.rx_handler(vp, buffer);
rx_datagram_state = DGUS_IDLE; rx_datagram_state = DGUS_IDLE;
@ -349,7 +346,7 @@ void DGUSDisplay::ProcessRx() {
break; break;
} }
DEBUG_ECHOLN(); DEBUG_EOL();
vp.rx_handler(vp, &tmp[3]); vp.rx_handler(vp, &tmp[3]);
rx_datagram_state = DGUS_IDLE; rx_datagram_state = DGUS_IDLE;

View file

@ -39,17 +39,17 @@ class WifiSerial {
void begin(uint32_t baud); void begin(uint32_t baud);
void begin(uint32_t baud, uint8_t config); void begin(uint32_t baud, uint8_t config);
void end(); void end();
int available(void); int available();
int read(void); int read();
int write(uint8_t); int write(uint8_t);
// Interrupt handlers // Interrupt handlers
static int _tx_complete_irq(serial_t *obj); static int _tx_complete_irq(serial_t *obj);
static void _rx_complete_irq(serial_t *obj); static void _rx_complete_irq(serial_t *obj);
void flush(void); void flush();
bool isHalfDuplex(void) const; bool isHalfDuplex() const;
void enableHalfDuplexRx(void); void enableHalfDuplexRx();
private: private:
void setRx(uint32_t _rx); void setRx(uint32_t _rx);

View file

@ -133,7 +133,7 @@ uint16_t W25QXXFlash::W25QXX_ReadID(void) {
return Temp; return Temp;
} }
void W25QXXFlash::SPI_FLASH_WriteEnable(void) { void W25QXXFlash::SPI_FLASH_WriteEnable() {
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
SPI_FLASH_CS_L(); SPI_FLASH_CS_L();
// Send "Write Enable" instruction // Send "Write Enable" instruction
@ -151,7 +151,7 @@ void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
* Output : None * Output : None
* Return : None * Return : None
*******************************************************************************/ *******************************************************************************/
void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) { void W25QXXFlash::SPI_FLASH_WaitForWriteEnd() {
uint8_t FLASH_Status = 0; uint8_t FLASH_Status = 0;
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
@ -216,7 +216,7 @@ void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
* Output : None * Output : None
* Return : None * Return : None
*******************************************************************************/ *******************************************************************************/
void W25QXXFlash::SPI_FLASH_BulkErase(void) { void W25QXXFlash::SPI_FLASH_BulkErase() {
// Send write enable instruction // Send write enable instruction
SPI_FLASH_WriteEnable(); SPI_FLASH_WriteEnable();

View file

@ -61,11 +61,11 @@ public:
static void spi_flash_Send(uint8_t b); static void spi_flash_Send(uint8_t b);
static void spi_flash_SendBlock(uint8_t token, const uint8_t *buf); static void spi_flash_SendBlock(uint8_t token, const uint8_t *buf);
static uint16_t W25QXX_ReadID(void); static uint16_t W25QXX_ReadID(void);
static void SPI_FLASH_WriteEnable(void); static void SPI_FLASH_WriteEnable();
static void SPI_FLASH_WaitForWriteEnd(void); static void SPI_FLASH_WaitForWriteEnd();
static void SPI_FLASH_SectorErase(uint32_t SectorAddr); static void SPI_FLASH_SectorErase(uint32_t SectorAddr);
static void SPI_FLASH_BlockErase(uint32_t BlockAddr); static void SPI_FLASH_BlockErase(uint32_t BlockAddr);
static void SPI_FLASH_BulkErase(void); static void SPI_FLASH_BulkErase();
static void SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite); static void SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite); static void SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead); static void SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);