Skip to content

Commit

Permalink
lowercase method / data member names
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 2, 2023
1 parent 6044cb9 commit 395af0c
Show file tree
Hide file tree
Showing 46 changed files with 2,345 additions and 2,343 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void startOrResumeJob() {
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
marlin_state = MF_RUNNING; // Signal to stop trying
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
TERN_(DGUS_LCD_UI_MKS, screen.sdPrintingFinished());
}
}

Expand Down
24 changes: 12 additions & 12 deletions Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace Anycubic {
tftSendLn(AC_msg_ready);
}

void DgusTFT::ParamInit() {
void DgusTFT::paramInit() {

#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("DgusTFT::ParamInit()");
Expand Down Expand Up @@ -668,7 +668,7 @@ namespace Anycubic {

#if ENABLED(POWER_LOSS_RECOVERY)

void DgusTFT::PowerLoss() {
void DgusTFT::powerLoss() {
// On: 5A A5 05 82 00 82 00 00
// Off: 5A A5 05 82 00 82 00 64
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) };
Expand All @@ -681,12 +681,12 @@ namespace Anycubic {

#endif // POWER_LOSS_RECOVERY

void DgusTFT::HomingStart() {
void DgusTFT::homingStart() {
if (!isPrintingFromMedia())
ChangePageOfTFT(PAGE_CHS_HOMING);
}

void DgusTFT::HomingComplete() {
void DgusTFT::homingComplete() {
if (lcd_info.language == ENG && page_index_last > 120)
page_index_last -= 120;

Expand Down Expand Up @@ -720,35 +720,35 @@ namespace Anycubic {
TFTSer.println();
}

void DgusTFT::SendValueToTFT(const uint16_t value, const uint16_t address) {
void DgusTFT::sendValueToTFT(const uint16_t value, const uint16_t address) {
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(value >> 8), uint8_t(value & 0xFF) };
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
}

void DgusTFT::RequestValueFromTFT(const uint16_t address) {
void DgusTFT::requestValueFromTFT(const uint16_t address) {
uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), 0x01 };
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
}

void DgusTFT::SendTxtToTFT(const char *pdata, const uint16_t address) {
void DgusTFT::sendTxtToTFT(const char *pdata, const uint16_t address) {
uint8_t data_len = strlen(pdata);
uint8_t data[] = { 0x5A, 0xA5, uint8_t(data_len + 5), 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF) };
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
LOOP_L_N(i, data_len) TFTSer.write(pdata[i]);
TFTSer.write(0xFF); TFTSer.write(0xFF);
}

void DgusTFT::SendColorToTFT(const uint16_t color, const uint16_t address) {
void DgusTFT::sendColorToTFT(const uint16_t color, const uint16_t address) {
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(color >> 8), uint8_t(color & 0xFF) };
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
}

void DgusTFT::SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) {
void DgusTFT::sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) {
uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), number };
LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]);
}

void DgusTFT::ChangePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) {
void DgusTFT::changePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) {
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("ChangePageOfTFT: ", page_index);
#endif
Expand Down Expand Up @@ -789,15 +789,15 @@ namespace Anycubic {
#endif
}

void DgusTFT::FakeChangePageOfTFT(const uint16_t page_index) {
void DgusTFT::fakeChangePageOfTFT(const uint16_t page_index) {
#if ACDEBUG(AC_MARLIN)
if (page_index_saved != page_index_now)
DEBUG_ECHOLNPGM("FakeChangePageOfTFT: ", page_index);
#endif
ChangePageOfTFT(page_index, true);
}

void DgusTFT::LcdAudioSet(const bool audio_on) {
void DgusTFT::lcdAudioSet(const bool audio_on) {
// On: 5A A5 07 82 00 80 5A 00 00 1A
// Off: 5A A5 07 82 00 80 5A 00 00 12
uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x80, 0x5A, 0x00, 0x00, uint8_t(audio_on ? 0x1A : 0x12) };
Expand Down
24 changes: 12 additions & 12 deletions Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,18 @@ namespace Anycubic {
static uint16_t page_index_now;

static void startup();
static void ParamInit();
static void paramInit();
static void idleLoop();
static void printerKilled(FSTR_P,FSTR_P);
static void mediaEvent(media_event_t);
static void timerEvent(timer_event_t);
static void filamentRunout();
static void confirmationRequest(const char * const);
static void statusChange(const char * const);
static void PowerLoss();
static void powerLoss();
static void powerLossRecovery();
static void HomingStart();
static void HomingComplete();
static void homingStart();
static void homingComplete();

static void set_descript_color(const uint16_t color, const uint8_t index=lcd_txtbox_index);
static void set_language(language_t);
Expand Down Expand Up @@ -462,14 +462,14 @@ namespace Anycubic {
static void panelAction(uint8_t);
static void panelProcess(uint8_t);

static void SendValueToTFT(const uint16_t value, const uint16_t address);
static void RequestValueFromTFT(const uint16_t address);
static void SendTxtToTFT(const char *pdata, const uint16_t address);
static void SendColorToTFT(const uint16_t color, const uint16_t address);
static void SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address);
static void ChangePageOfTFT(const uint16_t page_index, const bool no_send=false);
static void FakeChangePageOfTFT(const uint16_t page_index);
static void LcdAudioSet(const bool audio_on);
static void sendValueToTFT(const uint16_t value, const uint16_t address);
static void requestValueFromTFT(const uint16_t address);
static void sendTxtToTFT(const char *pdata, const uint16_t address);
static void sendColorToTFT(const uint16_t color, const uint16_t address);
static void sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address);
static void changePageOfTFT(const uint16_t page_index, const bool no_send=false);
static void fakeChangePageOfTFT(const uint16_t page_index);
static void lcdAudioSet(const bool audio_on);

private:

Expand Down
56 changes: 28 additions & 28 deletions Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
#include "DGUSVPVariable.h"
#include "DGUSDisplayDef.h"

DGUSDisplay dgusdisplay;
DGUSDisplay dgus;

#ifdef DEBUG_DGUSLCD_COMM
#ifdef DEBUG_DGUS_COMM
#define DEBUGLCDCOMM_ECHOPGM DEBUG_ECHOPGM
#else
#define DEBUGLCDCOMM_ECHOPGM(...) NOOP
Expand All @@ -63,7 +63,7 @@ constexpr uint8_t DGUS_CMD_READVAR = 0x83;
bool dguslcd_local_debug; // = false;
#endif

void DGUSDisplay::InitDisplay() {
void DGUSDisplay::initDisplay() {
#ifndef LCD_BAUDRATE
#define LCD_BAUDRATE 115200
#endif
Expand All @@ -73,13 +73,13 @@ void DGUSDisplay::InitDisplay() {
TERN_(DGUS_LCD_UI_MKS, delay(LOGO_TIME_DELAY)); // Show the logo for a little while
}

RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN));
requestScreen(TERN(SHOW_BOOTSCREEN, DGUS_SCREEN_BOOT, DGUS_SCREEN_MAIN));
}

void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
void DGUSDisplay::writeVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
const char* myvalues = static_cast<const char*>(values);
bool strend = !myvalues;
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
while (valueslen--) {
char x;
if (!strend) x = *myvalues++;
Expand All @@ -91,39 +91,39 @@ void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t values
}
}

void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
void DGUSDisplay::writeVariable(uint16_t adr, uint16_t value) {
value = (value & 0xFFU) << 8U | (value >> 8U);
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
}

void DGUSDisplay::WriteVariable(uint16_t adr, int16_t value) {
void DGUSDisplay::writeVariable(uint16_t adr, int16_t value) {
value = (value & 0xFFU) << 8U | (value >> 8U);
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
}

void DGUSDisplay::WriteVariable(uint16_t adr, uint8_t value) {
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint8_t));
void DGUSDisplay::writeVariable(uint16_t adr, uint8_t value) {
writeVariable(adr, static_cast<const void*>(&value), sizeof(uint8_t));
}

void DGUSDisplay::WriteVariable(uint16_t adr, int8_t value) {
WriteVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
void DGUSDisplay::writeVariable(uint16_t adr, int8_t value) {
writeVariable(adr, static_cast<const void*>(&value), sizeof(int8_t));
}

void DGUSDisplay::WriteVariable(uint16_t adr, long value) {
void DGUSDisplay::writeVariable(uint16_t adr, long value) {
union { long l; char lb[4]; } endian;
char tmp[4];
endian.l = value;
tmp[0] = endian.lb[3];
tmp[1] = endian.lb[2];
tmp[2] = endian.lb[1];
tmp[3] = endian.lb[0];
WriteVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
writeVariable(adr, static_cast<const void*>(&tmp), sizeof(long));
}

void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
void DGUSDisplay::writeVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) {
const char* myvalues = static_cast<const char*>(values);
bool strend = !myvalues;
WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen);
while (valueslen--) {
char x;
if (!strend) x = pgm_read_byte(myvalues++);
Expand All @@ -135,7 +135,7 @@ void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t val
}
}

void DGUSDisplay::ProcessRx() {
void DGUSDisplay::processRx() {

#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) {
Expand Down Expand Up @@ -174,8 +174,8 @@ void DGUSDisplay::ProcessRx() {
case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive.
if (LCD_SERIAL.available() < rx_datagram_len) return;

Initialized = true; // We've talked to it, so we defined it as initialized.
uint8_t command = LCD_SERIAL.read();
initialized = true; // We've talked to it, so we defined it as initialized.
const uint8_t command = LCD_SERIAL.read();

//DEBUGLCDCOMM_ECHOPGM("# ", command);

Expand Down Expand Up @@ -220,9 +220,9 @@ void DGUSDisplay::ProcessRx() {
}
}

size_t DGUSDisplay::GetFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); }
size_t DGUSDisplay::getFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); }

void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
void DGUSDisplay::writeHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
LCD_SERIAL.write(DGUS_HEADER1);
LCD_SERIAL.write(DGUS_HEADER2);
LCD_SERIAL.write(payloadlen + 3);
Expand All @@ -231,29 +231,29 @@ void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) {
LCD_SERIAL.write(adr & 0xFF);
}

void DGUSDisplay::WritePGM(const char str[], uint8_t len) {
void DGUSDisplay::writePGM(const char str[], uint8_t len) {
while (len--) LCD_SERIAL.write(pgm_read_byte(str++));
}

void DGUSDisplay::loop() {
// Protect against recursion. ProcessRx() may indirectly call idle() when injecting G-code commands.
// Protect against recursion. processRx() may indirectly call idle() when injecting G-code commands.
if (!no_reentrance) {
no_reentrance = true;
ProcessRx();
processRx();
no_reentrance = false;
}
}

rx_datagram_state_t DGUSDisplay::rx_datagram_state = DGUS_IDLE;
uint8_t DGUSDisplay::rx_datagram_len = 0;
bool DGUSDisplay::Initialized = false,
bool DGUSDisplay::initialized = false,
DGUSDisplay::no_reentrance = false;

// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() asm volatile("": : :"memory");

bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy) {
const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP);
const DGUS_VP_Variable *pvp = findVPVar(VP);
if (!pvp) return false;
memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable));
return true;
Expand Down
Loading

0 comments on commit 395af0c

Please sign in to comment.