0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 06:02:16 +00:00

🎨 Misc. code cleanup

This commit is contained in:
Scott Lahteine 2023-05-01 18:45:42 -05:00
parent f89fa4cec7
commit 4812ed5053
13 changed files with 53 additions and 52 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
@ -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)

View file

@ -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;
@ -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;

View file

@ -79,11 +79,11 @@ public:
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())
);

View file

@ -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);
@ -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) {

View file

@ -31,9 +31,10 @@
*
* ***************************************/
#include "string.h"
#include "../ui_api.h"
#include <string.h>
/*********************************/
#define FHONE (0x5A)
#define FHTWO (0xA5)

View file

@ -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"
@ -34,6 +33,8 @@
#include "../../../sd/cardreader.h"
#include "../../../MarlinCore.h"
#include <string.h>
extern uint16_t DeviceCode;
#if HAS_MEDIA

View file

View file

@ -27,4 +27,4 @@
#ifdef USBCON
USB_DM = PA_11,
USB_DP = PA_12,
#endif
#endif

View file

@ -413,7 +413,7 @@ const PinMap PinMap_USB_OTG_HS[] = {
*/
{NC, NP, 0}
};
#endif
#ifdef HAL_SD_MODULE_ENABLED
WEAK const PinMap PinMap_SD[] = {
@ -430,4 +430,3 @@ WEAK const PinMap PinMap_SD[] = {
{NC, NP, 0}
};
#endif
#endif