mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-29 23:07:42 +00:00
🎨 Misc. cleanup (from MMU3 PR)
Co-Authored-By: Erkan Ozgur Yilmaz <1786804+eoyilmaz@users.noreply.github.com>
This commit is contained in:
parent
8c78315f71
commit
0cd9643957
1
.gitignore
vendored
1
.gitignore
vendored
@ -125,6 +125,7 @@ vc-fileutils.settings
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Simulation files
|
||||
imgui.ini
|
||||
|
@ -50,7 +50,7 @@
|
||||
static Flags<_Nbr_16timers> DisablePending; // ISR should disable the timer at the next timer reset
|
||||
|
||||
// ------------------------
|
||||
/// Interrupt handler for the TC0 channel 1.
|
||||
// Interrupt handler for the TC0 channel 1.
|
||||
// ------------------------
|
||||
void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t);
|
||||
|
||||
|
@ -75,8 +75,8 @@ template <> void SERIAL_ECHO(const p_float_t pf) { SERIAL_IMPL.print(pf.value, p
|
||||
template <> void SERIAL_ECHO(const w_float_t wf) { char f1[20]; SERIAL_IMPL.print(dtostrf(wf.value, wf.width, wf.prec, f1)); }
|
||||
|
||||
// Specializations for F-string
|
||||
template <> void SERIAL_ECHO(const FSTR_P fstr) { SERIAL_ECHO_P(FTOP(fstr)); }
|
||||
template <> void SERIAL_ECHOLN(const FSTR_P fstr) { SERIAL_ECHOLN_P(FTOP(fstr)); }
|
||||
template <> void SERIAL_ECHO(FSTR_P const fstr) { SERIAL_ECHO_P(FTOP(fstr)); }
|
||||
template <> void SERIAL_ECHOLN(FSTR_P const fstr) { SERIAL_ECHOLN_P(FTOP(fstr)); }
|
||||
|
||||
void SERIAL_CHAR(char a) { SERIAL_IMPL.write(a); }
|
||||
void SERIAL_EOL() { SERIAL_CHAR('\n'); }
|
||||
|
@ -171,8 +171,8 @@ template<> void SERIAL_ECHO(const p_float_t pf);
|
||||
template<> void SERIAL_ECHO(const w_float_t wf);
|
||||
|
||||
// Specializations for F-string
|
||||
template<> void SERIAL_ECHO(const FSTR_P fstr);
|
||||
template<> void SERIAL_ECHOLN(const FSTR_P fstr);
|
||||
template<> void SERIAL_ECHO(FSTR_P const fstr);
|
||||
template<> void SERIAL_ECHOLN(FSTR_P const fstr);
|
||||
|
||||
// Print any number of items with arbitrary types (except loose PROGMEM strings)
|
||||
template <typename T, typename ... Args>
|
||||
|
@ -99,6 +99,7 @@ void GcodeSuite::D(const int16_t dcode) {
|
||||
} break;
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
|
||||
case 3: { // D3 Read / Write EEPROM
|
||||
uint8_t *pointer = parser.hex_adr_val('A');
|
||||
uint16_t len = parser.ushortval('C', 1);
|
||||
@ -107,7 +108,6 @@ void GcodeSuite::D(const int16_t dcode) {
|
||||
NOMORE(len, persistentStore.capacity() - addr);
|
||||
if (parser.seenval('X')) {
|
||||
uint16_t val = parser.hex_val('X');
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
while (len--) {
|
||||
int pos = 0;
|
||||
@ -115,27 +115,20 @@ void GcodeSuite::D(const int16_t dcode) {
|
||||
}
|
||||
SERIAL_EOL();
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
SERIAL_ECHOLNPGM("NO EEPROM");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// Read bytes from EEPROM
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
persistentStore.access_start();
|
||||
int pos = 0;
|
||||
uint8_t val;
|
||||
while (len--) if (!persistentStore.read_data(pos, &val, 1)) print_hex_byte(val);
|
||||
SERIAL_EOL();
|
||||
persistentStore.access_finish();
|
||||
#else
|
||||
SERIAL_ECHOLNPGM("NO EEPROM");
|
||||
len = 0;
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
|
||||
case 4: { // D4 Read / Write PIN
|
||||
//const bool is_out = parser.boolval('F');
|
||||
|
@ -1811,7 +1811,7 @@ void dwinPrintFinished() {
|
||||
// Print was aborted
|
||||
void dwinPrintAborted() {
|
||||
#ifndef EVENT_GCODE_SD_ABORT
|
||||
if (all_axes_homed()) {
|
||||
if (ExtUI::isMachineHomed()) {
|
||||
queue.inject(
|
||||
#if ENABLED(NOZZLE_PARK_FEATURE)
|
||||
F("G27")
|
||||
|
@ -114,11 +114,11 @@ extern DGUSDisplay dgus;
|
||||
// compile-time x^y
|
||||
constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
|
||||
|
||||
///
|
||||
//
|
||||
const uint16_t* findScreenVPMapList(uint8_t screen);
|
||||
|
||||
/// Find the flash address of a DGUS_VP_Variable for the VP.
|
||||
// Find the flash address of a DGUS_VP_Variable for the VP.
|
||||
const DGUS_VP_Variable* findVPVar(const uint16_t vp);
|
||||
|
||||
/// Helper to populate a DGUS_VP_Variable for a given VP. Return false if not found.
|
||||
// Helper to populate a DGUS_VP_Variable for a given VP. Return false if not found.
|
||||
bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy);
|
||||
|
@ -48,9 +48,9 @@ enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_Z_OFFSET = 222,
|
||||
DGUS_SCREEN_INFOS = 36,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_KILL = 250, //!< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_POPUP = 252, //!< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
|
@ -48,9 +48,9 @@ enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_PID_BED = 128,
|
||||
DGUS_SCREEN_INFOS = 131,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_KILL = 250, //!< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_POPUP = 252, //!< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
|
@ -235,9 +235,9 @@ enum DGUS_ScreenID : uint8_t {
|
||||
#endif
|
||||
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_KILL = 250, //!< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_POPUP = 252, //!< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
|
@ -43,9 +43,9 @@ enum DGUS_ScreenID : uint8_t {
|
||||
DGUS_SCREEN_FILAMENT_UNLOADING = 158,
|
||||
DGUS_SCREEN_SDPRINTTUNE = 170,
|
||||
DGUS_SCREEN_CONFIRM = 240,
|
||||
DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_KILL = 250, //!< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
|
||||
DGUS_SCREEN_WAITING = 251,
|
||||
DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_POPUP = 252, //!< special target, popup screen will also return this code to say "return to previous screen"
|
||||
DGUS_SCREEN_UNUSED = 255
|
||||
};
|
||||
|
||||
|
@ -159,5 +159,5 @@ private:
|
||||
|
||||
extern DGUSDisplay dgus;
|
||||
|
||||
/// Helper to populate a DGUS_VP for a given VP. Return false if not found.
|
||||
// Helper to populate a DGUS_VP for a given VP. Return false if not found.
|
||||
extern bool DGUS_PopulateVP(const DGUS_Addr addr, DGUS_VP * const buffer);
|
||||
|
@ -117,11 +117,11 @@ public:
|
||||
#endif
|
||||
|
||||
#if HAS_MEDIA
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void sdCardInserted();
|
||||
/// Marlin informed us that the SD Card has been removed().
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void sdCardRemoved();
|
||||
/// Marlin informed us about a bad SD Card.
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void sdCardError();
|
||||
|
||||
static const char* getSDCardPrintFilename() { return sdPrintFilename; }
|
||||
|
@ -178,5 +178,5 @@ template<> inline uint16_t DGUSDisplay::swapBytes(const uint16_t value) {
|
||||
|
||||
extern DGUSDisplay dgus;
|
||||
|
||||
/// Helper to populate a DGUS_VP for a given VP. Return false if not found.
|
||||
// Helper to populate a DGUS_VP for a given VP. Return false if not found.
|
||||
extern bool populateVP(const DGUS_Addr addr, DGUS_VP * const buffer);
|
||||
|
@ -53,11 +53,11 @@ public:
|
||||
static void filamentRunout(const ExtUI::extruder_t extruder);
|
||||
|
||||
#if HAS_MEDIA
|
||||
/// Marlin informed us that a new SD has been inserted.
|
||||
// Marlin informed us that a new SD has been inserted.
|
||||
static void sdCardInserted();
|
||||
/// Marlin informed us that the SD Card has been removed().
|
||||
// Marlin informed us that the SD Card has been removed().
|
||||
static void sdCardRemoved();
|
||||
/// Marlin informed us about a bad SD Card.
|
||||
// Marlin informed us about a bad SD Card.
|
||||
static void sdCardError();
|
||||
#endif
|
||||
|
||||
|
@ -161,12 +161,14 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
|
||||
#define scalePID_d(d) ( float(d) / PID_dT )
|
||||
#define unscalePID_d(d) ( float(d) * PID_dT )
|
||||
|
||||
/// @brief The default PID class, only has Kp, Ki, Kd, other classes extend this one
|
||||
/// @tparam MIN_POW output when current is above target by functional_range
|
||||
/// @tparam MAX_POW output when current is below target by functional_range
|
||||
/// @details This class has methods for Kc and Kf terms, but returns constant default values
|
||||
/// PID classes that implement these features are expected to override these methods
|
||||
/// Since the finally used PID class is typedef-d, there is no need to use virtual functions
|
||||
/**
|
||||
* @brief The default PID class, only has Kp, Ki, Kd, other classes extend this one
|
||||
* @tparam MIN_POW output when current is above target by functional_range
|
||||
* @tparam MAX_POW output when current is below target by functional_range
|
||||
* @details This class has methods for Kc and Kf terms, but returns constant default values.
|
||||
* PID classes that implement these features are expected to override these methods.
|
||||
* Since the eventual PID class is typedef-d, there is no need to use virtual functions.
|
||||
*/
|
||||
template<int MIN_POW, int MAX_POW>
|
||||
struct PID_t {
|
||||
protected:
|
||||
@ -241,7 +243,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
|
||||
|
||||
#if ENABLED(PIDTEMP)
|
||||
|
||||
/// @brief Extrusion scaled PID class
|
||||
// @brief Extrusion scaled PID class
|
||||
template<int MIN_POW, int MAX_POW, int LPQ_ARR_SZ>
|
||||
struct PIDC_t : public PID_t<MIN_POW, MAX_POW> {
|
||||
private:
|
||||
@ -293,11 +295,11 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
|
||||
}
|
||||
};
|
||||
|
||||
/// @brief Fan scaled PID, this class implements the get_fan_scale_output() method
|
||||
/// @tparam MIN_POW @see PID_t
|
||||
/// @tparam MAX_POW @see PID_t
|
||||
/// @tparam SCALE_MIN_SPEED parameter from Configuration_adv.h
|
||||
/// @tparam SCALE_LIN_FACTOR parameter from Configuration_adv.h
|
||||
// @brief Fan scaled PID, this class implements the get_fan_scale_output() method
|
||||
// @tparam MIN_POW @see PID_t
|
||||
// @tparam MAX_POW @see PID_t
|
||||
// @tparam SCALE_MIN_SPEED parameter from Configuration_adv.h
|
||||
// @tparam SCALE_LIN_FACTOR parameter from Configuration_adv.h
|
||||
template<int MIN_POW, int MAX_POW, int SCALE_MIN_SPEED, int SCALE_LIN_FACTOR>
|
||||
struct PIDF_t : public PID_t<MIN_POW, MAX_POW> {
|
||||
private:
|
||||
@ -327,7 +329,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
|
||||
}
|
||||
};
|
||||
|
||||
/// @brief Inherits PID and PIDC - can't use proper diamond inheritance w/o virtual
|
||||
// @brief Inherits PID and PIDC - can't use proper diamond inheritance w/o virtual
|
||||
template<int MIN_POW, int MAX_POW, int LPQ_ARR_SZ, int SCALE_MIN_SPEED, int SCALE_LIN_FACTOR>
|
||||
struct PIDCF_t : public PIDC_t<MIN_POW, MAX_POW, LPQ_ARR_SZ> {
|
||||
private:
|
||||
|
@ -86,7 +86,7 @@ extern "C" {
|
||||
#define PH1 50 // | 50 | | | | | | OSC_OUT |
|
||||
// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
|
||||
|
||||
/// This must be a literal
|
||||
// This must be a literal
|
||||
#define NUM_DIGITAL_PINS 51
|
||||
#define NUM_ANALOG_INPUTS 16
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user