Skip to content

Commit

Permalink
🎨 Misc. code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 2, 2023
1 parent f89fa4c commit 4812ed5
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 52 deletions.
22 changes: 11 additions & 11 deletions Marlin/src/HAL/DUE/MinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ void install_min_serial() {
}

#if DISABLED(DYNAMIC_VECTORTABLE)
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
#endif

#endif // POSTMORTEM_DEBUGGING
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/HAL/LPC1768/MinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ static void TX(char c) { _DBC(c); }
void install_min_serial() { HAL_min_serial_out = &TX; }

#if DISABLED(DYNAMIC_VECTORTABLE)
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
#endif

#endif // POSTMORTEM_DEBUGGING
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/HAL/STM32/MinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ void install_min_serial() {
}

#if NONE(DYNAMIC_VECTORTABLE, STM32F0xx, STM32G0xx) // Cortex M0 can't jump to a symbol that's too far from the current function, so we work around this in exception_arm.cpp
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) NMI_Handler();
}
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) NMI_Handler();
}
#endif

#endif // POSTMORTEM_DEBUGGING
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
// Wait for buffered blocks to complete
planner.synchronize();

#if ENABLED(ADVANCED_PAUSE_FANS_PAUSE) && HAS_FAN
#if BOTH(ADVANCED_PAUSE_FANS_PAUSE, HAS_FAN)
thermalManager.set_fans_paused(true);
#endif

Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ class FilamentSensorBase {
public:
static void setup() {
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN)
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN

#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN)
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN);
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#endif
#undef _INIT_RUNOUT_PIN
Expand All @@ -212,9 +212,9 @@ class FilamentSensorBase {

// Return a bitmask of runout flag states (1 bits always indicates runout)
static uint8_t poll_runout_states() {
#define _OR_RUNOUT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1))
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_RUNOUT));
#undef _OR_RUNOUT
#define _INVERT_BIT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1))
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _INVERT_BIT));
#undef _INVERT_BIT
}

#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PGM_P GCodeQueue::injected_commands_P; // = nullptr
*/
char GCodeQueue::injected_commands[64]; // = { 0 }

void GCodeQueue::RingBuffer::commit_command(bool skip_ok
void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind/*=-1*/)
) {
commands[index_w].skip_ok = skip_ok;
Expand All @@ -113,7 +113,7 @@ void GCodeQueue::RingBuffer::commit_command(bool skip_ok
* Return true if the command was successfully added.
* Return false for a full buffer, or if the 'command' is a comment.
*/
bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/
bool GCodeQueue::RingBuffer::enqueue(const char *cmd, const bool skip_ok/*=true*/
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind/*=-1*/)
) {
if (*cmd == ';' || length >= BUFSIZE) return false;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class GCodeQueue {

void advance_pos(uint8_t &p, const int inc) { if (++p >= BUFSIZE) p = 0; length += inc; }

void commit_command(bool skip_ok
void commit_command(const bool skip_ok
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind = serial_index_t())
);

bool enqueue(const char *cmd, bool skip_ok = true
bool enqueue(const char *cmd, const bool skip_ok=true
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind = serial_index_t())
);

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/ia_creality/creality_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ namespace ExtUI {
TPShowStatus = false;
ZERO(ChangeMaterialbuf);
ChangeMaterialbuf[1] = ChangeMaterialbuf[0] = 10;
RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show,instead of current_position[E_AXIS] in them.
RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them.
RTS_SndData(10 * ChangeMaterialbuf[1], FilamentUnit2);
RTS_SndData(getActualTemp_celsius(H0), NozzleTemp);
RTS_SndData(getTargetTemp_celsius(H0), NozzlePreheat);
Expand Down Expand Up @@ -1381,7 +1381,7 @@ namespace ExtUI {
case 0xF0: // not to cancel heating
break;
}
RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show,instead of current_position[E_AXIS] in them.
RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them.
RTS_SndData(10 * ChangeMaterialbuf[1], FilamentUnit2);
}
else if (recdat.addr == FilamentUnit1) {
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
*
* ***************************************/

#include "string.h"
#include "../ui_api.h"

#include <string.h>

/*********************************/
#define FHONE (0x5A)
#define FHTWO (0xA5)
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/extui/mks_ui/pic_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#if HAS_TFT_LVGL_UI

#include "string.h"
#include "draw_ui.h"
#include "pic_manager.h"
#include "draw_ready_print.h"
Expand All @@ -34,6 +33,8 @@
#include "../../../sd/cardreader.h"
#include "../../../MarlinCore.h"

#include <string.h>

extern uint16_t DeviceCode;

#if HAS_MEDIA
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
#ifdef USBCON
USB_DM = PA_11,
USB_DP = PA_12,
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ const PinMap PinMap_USB_OTG_HS[] = {
*/
{NC, NP, 0}
};

#endif

#ifdef HAL_SD_MODULE_ENABLED
WEAK const PinMap PinMap_SD[] = {
Expand All @@ -430,4 +430,3 @@ WEAK const PinMap PinMap_SD[] = {
{NC, NP, 0}
};
#endif
#endif

0 comments on commit 4812ed5

Please sign in to comment.