Merge pull request #4353 from jbrazio/global-enum-file
General cleanup: enum
This commit is contained in:
commit
c502018eab
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
#include "enum.h"
|
||||||
|
|
||||||
typedef unsigned long millis_t;
|
typedef unsigned long millis_t;
|
||||||
|
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
@ -230,20 +232,8 @@ void manage_inactivity(bool ignore_stepper_queue = false);
|
|||||||
* The axis order in all axis related arrays is X, Y, Z, E
|
* The axis order in all axis related arrays is X, Y, Z, E
|
||||||
*/
|
*/
|
||||||
#define NUM_AXIS 4
|
#define NUM_AXIS 4
|
||||||
|
|
||||||
/**
|
|
||||||
* Axis indices as enumerated constants
|
|
||||||
*
|
|
||||||
* A_AXIS and B_AXIS are used by COREXY printers
|
|
||||||
* X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
|
|
||||||
*/
|
|
||||||
enum AxisEnum {NO_AXIS = -1, X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_AXIS = 2, C_AXIS = 2, E_AXIS = 3, X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 5};
|
|
||||||
|
|
||||||
#define _AXIS(AXIS) AXIS ##_AXIS
|
#define _AXIS(AXIS) AXIS ##_AXIS
|
||||||
|
|
||||||
typedef enum { LINEARUNIT_MM = 0, LINEARUNIT_INCH = 1 } LinearUnit;
|
|
||||||
typedef enum { TEMPUNIT_C = 0, TEMPUNIT_K = 1, TEMPUNIT_F = 2 } TempUnit;
|
|
||||||
|
|
||||||
void enable_all_steppers();
|
void enable_all_steppers();
|
||||||
void disable_all_steppers();
|
void disable_all_steppers();
|
||||||
|
|
||||||
@ -259,18 +249,6 @@ void quickstop_stepper();
|
|||||||
void handle_filament_runout();
|
void handle_filament_runout();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Debug flags - not yet widely applied
|
|
||||||
*/
|
|
||||||
enum DebugFlags {
|
|
||||||
DEBUG_NONE = 0,
|
|
||||||
DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
|
|
||||||
DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
|
|
||||||
DEBUG_ERRORS = _BV(2), ///< Not implemented
|
|
||||||
DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
|
|
||||||
DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
|
|
||||||
DEBUG_LEVELING = _BV(5) ///< Print detailed output for homing and leveling
|
|
||||||
};
|
|
||||||
extern uint8_t marlin_debug_flags;
|
extern uint8_t marlin_debug_flags;
|
||||||
#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
|
#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F))
|
||||||
|
|
||||||
@ -380,11 +358,6 @@ float code_value_temp_diff();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
||||||
enum FilamentChangeMenuResponse {
|
|
||||||
FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
|
|
||||||
FILAMENT_CHANGE_RESPONSE_EXTRUDE_MORE,
|
|
||||||
FILAMENT_CHANGE_RESPONSE_RESUME_PRINT
|
|
||||||
};
|
|
||||||
extern FilamentChangeMenuResponse filament_change_menu_response;
|
extern FilamentChangeMenuResponse filament_change_menu_response;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -455,21 +455,6 @@ MarlinSerial customizedSerial;
|
|||||||
|
|
||||||
FORCE_INLINE void emergency_parser(unsigned char c) {
|
FORCE_INLINE void emergency_parser(unsigned char c) {
|
||||||
|
|
||||||
enum e_parser_state {
|
|
||||||
state_RESET,
|
|
||||||
state_N,
|
|
||||||
state_M,
|
|
||||||
state_M1,
|
|
||||||
state_M10,
|
|
||||||
state_M108,
|
|
||||||
state_M11,
|
|
||||||
state_M112,
|
|
||||||
state_M4,
|
|
||||||
state_M41,
|
|
||||||
state_M410,
|
|
||||||
state_IGNORE // to '\n'
|
|
||||||
};
|
|
||||||
|
|
||||||
static e_parser_state state = state_RESET;
|
static e_parser_state state = state_RESET;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -535,17 +535,6 @@ static bool send_ok[BUFSIZE];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
|
|
||||||
// States for managing Marlin and host communication
|
|
||||||
// Marlin sends messages if blocked or busy
|
|
||||||
enum MarlinBusyState {
|
|
||||||
NOT_BUSY, // Not in a handler
|
|
||||||
IN_HANDLER, // Processing a GCode
|
|
||||||
IN_PROCESS, // Known to be blocking command input (as in G29)
|
|
||||||
PAUSED_FOR_USER, // Blocking pending any input
|
|
||||||
PAUSED_FOR_INPUT // Blocking pending text input (concept)
|
|
||||||
};
|
|
||||||
|
|
||||||
static MarlinBusyState busy_state = NOT_BUSY;
|
static MarlinBusyState busy_state = NOT_BUSY;
|
||||||
static millis_t next_busy_signal_ms = 0;
|
static millis_t next_busy_signal_ms = 0;
|
||||||
uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
||||||
@ -3220,9 +3209,6 @@ inline void gcode_G28() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet, MeshSetZOffset, MeshReset };
|
|
||||||
|
|
||||||
inline void _mbl_goto_xy(float x, float y) {
|
inline void _mbl_goto_xy(float x, float y) {
|
||||||
float old_feedrate_mm_m = feedrate_mm_m;
|
float old_feedrate_mm_m = feedrate_mm_m;
|
||||||
feedrate_mm_m = homing_feedrate_mm_m[X_AXIS];
|
feedrate_mm_m = homing_feedrate_mm_m[X_AXIS];
|
||||||
@ -6832,7 +6818,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
// <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
|
// <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
|
||||||
float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
|
float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
|
||||||
z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
|
z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
|
||||||
|
|
||||||
// Always raise by some amount
|
// Always raise by some amount
|
||||||
planner.buffer_line(
|
planner.buffer_line(
|
||||||
current_position[X_AXIS],
|
current_position[X_AXIS],
|
||||||
@ -6843,10 +6829,10 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
active_extruder
|
active_extruder
|
||||||
);
|
);
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
|
|
||||||
move_extruder_servo(active_extruder);
|
move_extruder_servo(active_extruder);
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
// Move back down, if needed
|
// Move back down, if needed
|
||||||
if (z_raise != z_diff) {
|
if (z_raise != z_diff) {
|
||||||
planner.buffer_line(
|
planner.buffer_line(
|
||||||
@ -6860,7 +6846,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set current_position to the position of the new nozzle.
|
* Set current_position to the position of the new nozzle.
|
||||||
* Offsets are based on linear distance, so we need to get
|
* Offsets are based on linear distance, so we need to get
|
||||||
@ -6913,7 +6899,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
current_position[Z_AXIS] += offset_vec.z;
|
current_position[Z_AXIS] += offset_vec.z;
|
||||||
|
|
||||||
#else // !AUTO_BED_LEVELING_FEATURE
|
#else // !AUTO_BED_LEVELING_FEATURE
|
||||||
|
|
||||||
float xydiff[2] = {
|
float xydiff[2] = {
|
||||||
hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
||||||
hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
||||||
@ -6937,7 +6923,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // MESH_BED_LEVELING
|
#endif // MESH_BED_LEVELING
|
||||||
|
|
||||||
#endif // !AUTO_BED_LEVELING_FEATURE
|
#endif // !AUTO_BED_LEVELING_FEATURE
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
@ -7000,7 +6986,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|||||||
SERIAL_ECHOLNPGM("<<< gcode_T");
|
SERIAL_ECHOLNPGM("<<< gcode_T");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
|
SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
|
||||||
SERIAL_PROTOCOLLN((int)active_extruder);
|
SERIAL_PROTOCOLLN((int)active_extruder);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
#define MAX_DIR_DEPTH 10 // Maximum folder depth
|
||||||
|
|
||||||
#include "SdFile.h"
|
#include "SdFile.h"
|
||||||
enum LsAction { LS_SerialPrint, LS_Count, LS_GetFilename };
|
#include "enum.h"
|
||||||
|
|
||||||
class CardReader {
|
class CardReader {
|
||||||
public:
|
public:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#ifndef ENDSTOPS_H
|
#ifndef ENDSTOPS_H
|
||||||
#define ENDSTOPS_H
|
#define ENDSTOPS_H
|
||||||
|
|
||||||
enum EndstopEnum {X_MIN = 0, Y_MIN = 1, Z_MIN = 2, Z_MIN_PROBE = 3, X_MAX = 4, Y_MAX = 5, Z_MAX = 6, Z2_MIN = 7, Z2_MAX = 8};
|
#include "enum.h"
|
||||||
|
|
||||||
class Endstops {
|
class Endstops {
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class Endstops {
|
|||||||
static byte
|
static byte
|
||||||
#endif
|
#endif
|
||||||
current_endstop_bits, old_endstop_bits;
|
current_endstop_bits, old_endstop_bits;
|
||||||
|
|
||||||
Endstops() {};
|
Endstops() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
190
Marlin/enum.h
Normal file
190
Marlin/enum.h
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ENUM_H__
|
||||||
|
#define __ENUM_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Axis indices as enumerated constants
|
||||||
|
*
|
||||||
|
* Special axis:
|
||||||
|
* - A_AXIS and B_AXIS are used by COREXY printers
|
||||||
|
* - X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship
|
||||||
|
* between X_AXIS and X Head movement, like CoreXY bots
|
||||||
|
*/
|
||||||
|
enum AxisEnum {
|
||||||
|
NO_AXIS = -1,
|
||||||
|
X_AXIS = 0,
|
||||||
|
A_AXIS = 0,
|
||||||
|
Y_AXIS = 1,
|
||||||
|
B_AXIS = 1,
|
||||||
|
Z_AXIS = 2,
|
||||||
|
C_AXIS = 2,
|
||||||
|
E_AXIS = 3,
|
||||||
|
X_HEAD = 4,
|
||||||
|
Y_HEAD = 5,
|
||||||
|
Z_HEAD = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LINEARUNIT_MM,
|
||||||
|
LINEARUNIT_INCH
|
||||||
|
} LinearUnit;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEMPUNIT_C,
|
||||||
|
TEMPUNIT_K,
|
||||||
|
TEMPUNIT_F
|
||||||
|
} TempUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug flags
|
||||||
|
* Not yet widely applied
|
||||||
|
*/
|
||||||
|
enum DebugFlags {
|
||||||
|
DEBUG_NONE = 0,
|
||||||
|
DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
|
||||||
|
DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
|
||||||
|
DEBUG_ERRORS = _BV(2), ///< Not implemented
|
||||||
|
DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
|
||||||
|
DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
|
||||||
|
DEBUG_LEVELING = _BV(5) ///< Print detailed output for homing and leveling
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EndstopEnum {
|
||||||
|
X_MIN,
|
||||||
|
Y_MIN,
|
||||||
|
Z_MIN,
|
||||||
|
Z_MIN_PROBE,
|
||||||
|
X_MAX,
|
||||||
|
Y_MAX,
|
||||||
|
Z_MAX,
|
||||||
|
Z2_MIN,
|
||||||
|
Z2_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temperature
|
||||||
|
* Stages in the ISR loop
|
||||||
|
*/
|
||||||
|
enum TempState {
|
||||||
|
PrepareTemp_0,
|
||||||
|
MeasureTemp_0,
|
||||||
|
PrepareTemp_BED,
|
||||||
|
MeasureTemp_BED,
|
||||||
|
PrepareTemp_1,
|
||||||
|
MeasureTemp_1,
|
||||||
|
PrepareTemp_2,
|
||||||
|
MeasureTemp_2,
|
||||||
|
PrepareTemp_3,
|
||||||
|
MeasureTemp_3,
|
||||||
|
Prepare_FILWIDTH,
|
||||||
|
Measure_FILWIDTH,
|
||||||
|
StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
|
||||||
|
};
|
||||||
|
|
||||||
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
enum e_parser_state {
|
||||||
|
state_RESET,
|
||||||
|
state_N,
|
||||||
|
state_M,
|
||||||
|
state_M1,
|
||||||
|
state_M10,
|
||||||
|
state_M108,
|
||||||
|
state_M11,
|
||||||
|
state_M112,
|
||||||
|
state_M4,
|
||||||
|
state_M41,
|
||||||
|
state_M410,
|
||||||
|
state_IGNORE // to '\n'
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
||||||
|
enum FilamentChangeMenuResponse {
|
||||||
|
FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
|
||||||
|
FILAMENT_CHANGE_RESPONSE_EXTRUDE_MORE,
|
||||||
|
FILAMENT_CHANGE_RESPONSE_RESUME_PRINT
|
||||||
|
};
|
||||||
|
|
||||||
|
#if ENABLED(ULTIPANEL)
|
||||||
|
enum FilamentChangeMessage {
|
||||||
|
FILAMENT_CHANGE_MESSAGE_INIT,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_UNLOAD,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_INSERT,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_LOAD,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_EXTRUDE,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_OPTION,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_RESUME,
|
||||||
|
FILAMENT_CHANGE_MESSAGE_STATUS
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* States for managing Marlin and host communication
|
||||||
|
* Marlin sends messages if blocked or busy
|
||||||
|
*/
|
||||||
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
|
enum MarlinBusyState {
|
||||||
|
NOT_BUSY, // Not in a handler
|
||||||
|
IN_HANDLER, // Processing a GCode
|
||||||
|
IN_PROCESS, // Known to be blocking command input (as in G29)
|
||||||
|
PAUSED_FOR_USER, // Blocking pending any input
|
||||||
|
PAUSED_FOR_INPUT // Blocking pending text input (concept)
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
enum MeshLevelingState {
|
||||||
|
MeshReport,
|
||||||
|
MeshStart,
|
||||||
|
MeshNext,
|
||||||
|
MeshSet,
|
||||||
|
MeshSetZOffset,
|
||||||
|
MeshReset
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MBLStatus {
|
||||||
|
MBL_STATUS_NONE = 0,
|
||||||
|
MBL_STATUS_HAS_MESH_BIT = 0,
|
||||||
|
MBL_STATUS_ACTIVE_BIT = 1
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SD Card
|
||||||
|
*/
|
||||||
|
enum LsAction { LS_SerialPrint, LS_Count, LS_GetFilename };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ultra LCD
|
||||||
|
*/
|
||||||
|
enum LCDViewAction {
|
||||||
|
LCDVIEW_NONE,
|
||||||
|
LCDVIEW_REDRAW_NOW,
|
||||||
|
LCDVIEW_CALL_REDRAW_NEXT,
|
||||||
|
LCDVIEW_CLEAR_CALL_REDRAW,
|
||||||
|
LCDVIEW_CALL_NO_REDRAW
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __ENUM_H__
|
@ -23,9 +23,6 @@
|
|||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
enum MBLStatus { MBL_STATUS_NONE = 0, MBL_STATUS_HAS_MESH_BIT = 0, MBL_STATUS_ACTIVE_BIT = 1 };
|
|
||||||
|
|
||||||
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1))
|
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1))
|
||||||
#define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1))
|
#define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1))
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ bool Stopwatch::stop() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (this->isRunning() || this->isPaused()) {
|
if (this->isRunning() || this->isPaused()) {
|
||||||
this->state = STOPWATCH_STOPPED;
|
this->state = STOPPED;
|
||||||
this->stopTimestamp = millis();
|
this->stopTimestamp = millis();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ bool Stopwatch::pause() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (this->isRunning()) {
|
if (this->isRunning()) {
|
||||||
this->state = STOPWATCH_PAUSED;
|
this->state = PAUSED;
|
||||||
this->stopTimestamp = millis();
|
this->stopTimestamp = millis();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ bool Stopwatch::start() {
|
|||||||
if (this->isPaused()) this->accumulator = this->duration();
|
if (this->isPaused()) this->accumulator = this->duration();
|
||||||
else this->reset();
|
else this->reset();
|
||||||
|
|
||||||
this->state = STOPWATCH_RUNNING;
|
this->state = RUNNING;
|
||||||
this->startTimestamp = millis();
|
this->startTimestamp = millis();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -74,18 +74,18 @@ void Stopwatch::reset() {
|
|||||||
Stopwatch::debug(PSTR("reset"));
|
Stopwatch::debug(PSTR("reset"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->state = STOPWATCH_STOPPED;
|
this->state = STOPPED;
|
||||||
this->startTimestamp = 0;
|
this->startTimestamp = 0;
|
||||||
this->stopTimestamp = 0;
|
this->stopTimestamp = 0;
|
||||||
this->accumulator = 0;
|
this->accumulator = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stopwatch::isRunning() {
|
bool Stopwatch::isRunning() {
|
||||||
return (this->state == STOPWATCH_RUNNING) ? true : false;
|
return (this->state == RUNNING) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stopwatch::isPaused() {
|
bool Stopwatch::isPaused() {
|
||||||
return (this->state == STOPWATCH_PAUSED) ? true : false;
|
return (this->state == PAUSED) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
millis_t Stopwatch::duration() {
|
millis_t Stopwatch::duration() {
|
||||||
|
@ -28,12 +28,6 @@
|
|||||||
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
|
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
|
||||||
//#define DEBUG_STOPWATCH
|
//#define DEBUG_STOPWATCH
|
||||||
|
|
||||||
enum StopwatchState {
|
|
||||||
STOPWATCH_STOPPED,
|
|
||||||
STOPWATCH_RUNNING,
|
|
||||||
STOPWATCH_PAUSED
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Stopwatch class
|
* @brief Stopwatch class
|
||||||
* @details This class acts as a timer proving stopwatch functionality including
|
* @details This class acts as a timer proving stopwatch functionality including
|
||||||
@ -41,7 +35,13 @@ enum StopwatchState {
|
|||||||
*/
|
*/
|
||||||
class Stopwatch {
|
class Stopwatch {
|
||||||
private:
|
private:
|
||||||
StopwatchState state;
|
enum State {
|
||||||
|
STOPPED,
|
||||||
|
RUNNING,
|
||||||
|
PAUSED
|
||||||
|
};
|
||||||
|
|
||||||
|
Stopwatch::State state;
|
||||||
millis_t accumulator;
|
millis_t accumulator;
|
||||||
millis_t startTimestamp;
|
millis_t startTimestamp;
|
||||||
millis_t stopTimestamp;
|
millis_t stopTimestamp;
|
||||||
|
@ -1342,25 +1342,6 @@ void Temperature::disable_all_heaters() {
|
|||||||
|
|
||||||
#endif //HEATER_0_USES_MAX6675
|
#endif //HEATER_0_USES_MAX6675
|
||||||
|
|
||||||
/**
|
|
||||||
* Stages in the ISR loop
|
|
||||||
*/
|
|
||||||
enum TempState {
|
|
||||||
PrepareTemp_0,
|
|
||||||
MeasureTemp_0,
|
|
||||||
PrepareTemp_BED,
|
|
||||||
MeasureTemp_BED,
|
|
||||||
PrepareTemp_1,
|
|
||||||
MeasureTemp_1,
|
|
||||||
PrepareTemp_2,
|
|
||||||
MeasureTemp_2,
|
|
||||||
PrepareTemp_3,
|
|
||||||
MeasureTemp_3,
|
|
||||||
Prepare_FILWIDTH,
|
|
||||||
Measure_FILWIDTH,
|
|
||||||
StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get raw temperatures
|
* Get raw temperatures
|
||||||
*/
|
*/
|
||||||
|
@ -54,14 +54,6 @@ static void lcd_status_screen();
|
|||||||
|
|
||||||
millis_t next_lcd_update_ms;
|
millis_t next_lcd_update_ms;
|
||||||
|
|
||||||
enum LCDViewAction {
|
|
||||||
LCDVIEW_NONE,
|
|
||||||
LCDVIEW_REDRAW_NOW,
|
|
||||||
LCDVIEW_CALL_REDRAW_NEXT,
|
|
||||||
LCDVIEW_CLEAR_CALL_REDRAW,
|
|
||||||
LCDVIEW_CALL_NO_REDRAW
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
@ -133,7 +125,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
|
|||||||
static void lcd_filament_change_load_message();
|
static void lcd_filament_change_load_message();
|
||||||
static void lcd_filament_change_extrude_message();
|
static void lcd_filament_change_extrude_message();
|
||||||
static void lcd_filament_change_resume_message();
|
static void lcd_filament_change_resume_message();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_LCD_CONTRAST
|
#if HAS_LCD_CONTRAST
|
||||||
static void lcd_set_contrast();
|
static void lcd_set_contrast();
|
||||||
@ -301,7 +293,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
|
|||||||
* Scroll as-needed to keep the selected line in view.
|
* Scroll as-needed to keep the selected line in view.
|
||||||
*
|
*
|
||||||
* At this point _thisItemNr equals the total number of items.
|
* At this point _thisItemNr equals the total number of items.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Simple-scroll by using encoderLine as encoderTopLine
|
// Simple-scroll by using encoderLine as encoderTopLine
|
||||||
@ -2207,7 +2199,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
#endif
|
#endif
|
||||||
END_SCREEN();
|
END_SCREEN();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_filament_change_show_message(FilamentChangeMessage message) {
|
void lcd_filament_change_show_message(FilamentChangeMessage message) {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case FILAMENT_CHANGE_MESSAGE_INIT:
|
case FILAMENT_CHANGE_MESSAGE_INIT:
|
||||||
@ -2507,7 +2499,7 @@ int lcd_strlen_P(const char* s) {
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
while (pgm_read_byte(s)) {
|
while (pgm_read_byte(s)) {
|
||||||
#ifdef MAPPER_NON
|
#ifdef MAPPER_NON
|
||||||
j++;
|
j++;
|
||||||
#else
|
#else
|
||||||
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
|
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,16 +73,6 @@
|
|||||||
void lcd_ignore_click(bool b=true);
|
void lcd_ignore_click(bool b=true);
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
#if ENABLED(FILAMENT_CHANGE_FEATURE)
|
||||||
enum FilamentChangeMessage {
|
|
||||||
FILAMENT_CHANGE_MESSAGE_INIT,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_UNLOAD,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_INSERT,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_LOAD,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_EXTRUDE,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_OPTION,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_RESUME,
|
|
||||||
FILAMENT_CHANGE_MESSAGE_STATUS
|
|
||||||
};
|
|
||||||
void lcd_filament_change_show_message(FilamentChangeMessage message);
|
void lcd_filament_change_show_message(FilamentChangeMessage message);
|
||||||
#endif // FILAMENT_CHANGE_FEATURE
|
#endif // FILAMENT_CHANGE_FEATURE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user