commit
0ffd33c142
|
|
@ -278,7 +278,9 @@ void IR_sensor_analog::voltUpdate(uint16_t raw) { // to be called from the ADC I
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t IR_sensor_analog::getVoltRaw() {
|
uint16_t IR_sensor_analog::getVoltRaw() {
|
||||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { return voltRaw; }
|
uint16_t ret;
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ret = voltRaw; }
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *IR_sensor_analog::getIRVersionText() {
|
const char *IR_sensor_analog::getIRVersionText() {
|
||||||
|
|
@ -339,7 +341,9 @@ bool IR_sensor_analog::checkVoltage(uint16_t raw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IR_sensor_analog::getVoltReady() const {
|
bool IR_sensor_analog::getVoltReady() const {
|
||||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE){ return voltReady; }
|
bool ret;
|
||||||
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE){ ret = voltReady; }
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IR_sensor_analog::clearVoltReady(){
|
void IR_sensor_analog::clearVoltReady(){
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,8 @@ bool MMU2::set_filament_type(uint8_t index, uint8_t type) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// @@TODO - this is not supported in the new MMU yet
|
// @@TODO - this is not supported in the new MMU yet
|
||||||
|
index = index; // @@TODO
|
||||||
|
type = type; // @@TODO
|
||||||
// cmd_arg = filamentType;
|
// cmd_arg = filamentType;
|
||||||
// command(MMU_CMD_F0 + index);
|
// command(MMU_CMD_F0 + index);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -279,9 +279,8 @@ private:
|
||||||
/// unlike the mid-print ToolChange commands, which only load the first ~30mm and then the G-code takes over.
|
/// unlike the mid-print ToolChange commands, which only load the first ~30mm and then the G-code takes over.
|
||||||
bool loadingToNozzle;
|
bool loadingToNozzle;
|
||||||
|
|
||||||
uint8_t retryAttempts;
|
|
||||||
|
|
||||||
bool inAutoRetry;
|
bool inAutoRetry;
|
||||||
|
uint8_t retryAttempts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// following Marlin's way of doing stuff - one and only instance of MMU implementation in the code base
|
/// following Marlin's way of doing stuff - one and only instance of MMU implementation in the code base
|
||||||
|
|
|
||||||
|
|
@ -132,24 +132,24 @@ uint16_t PrusaErrorCode(uint8_t i){
|
||||||
return pgm_read_word(errorCodes + i);
|
return pgm_read_word(errorCodes + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const PrusaErrorTitle(uint8_t i){
|
const char * PrusaErrorTitle(uint8_t i){
|
||||||
return (const char * const)pgm_read_ptr(errorTitles + i);
|
return (const char *)pgm_read_ptr(errorTitles + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const PrusaErrorDesc(uint8_t i){
|
const char * PrusaErrorDesc(uint8_t i){
|
||||||
return (const char * const)pgm_read_ptr(errorDescs + i);
|
return (const char *)pgm_read_ptr(errorDescs + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t PrusaErrorButtons(uint8_t i){
|
uint8_t PrusaErrorButtons(uint8_t i){
|
||||||
return pgm_read_byte(errorButtons + i);
|
return pgm_read_byte(errorButtons + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const PrusaErrorButtonTitle(uint8_t bi){
|
const char * PrusaErrorButtonTitle(uint8_t bi){
|
||||||
// -1 represents the hidden NoOperation button which is not drawn in any way
|
// -1 represents the hidden NoOperation button which is not drawn in any way
|
||||||
return (const char * const)pgm_read_ptr(btnOperation + bi - 1);
|
return (const char *)pgm_read_ptr(btnOperation + bi - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const PrusaErrorButtonMore(){
|
const char * PrusaErrorButtonMore(){
|
||||||
return _R(MSG_BTN_MORE);
|
return _R(MSG_BTN_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ uint8_t PrusaErrorCodeIndex(uint16_t ec);
|
||||||
|
|
||||||
/// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
|
/// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
|
||||||
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
||||||
const char * const PrusaErrorTitle(uint8_t i);
|
const char * PrusaErrorTitle(uint8_t i);
|
||||||
|
|
||||||
/// @returns pointer to a PROGMEM string representing the multi-page Description of the Prusa-Error-Codes error
|
/// @returns pointer to a PROGMEM string representing the multi-page Description of the Prusa-Error-Codes error
|
||||||
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
||||||
const char * const PrusaErrorDesc(uint8_t i);
|
const char * PrusaErrorDesc(uint8_t i);
|
||||||
|
|
||||||
/// @returns the actual numerical value of the Prusa-Error-Codes error
|
/// @returns the actual numerical value of the Prusa-Error-Codes error
|
||||||
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
||||||
|
|
@ -27,10 +27,10 @@ uint8_t PrusaErrorButtons(uint8_t i);
|
||||||
|
|
||||||
/// @returns pointer to a PROGMEM string representing the Title of a button
|
/// @returns pointer to a PROGMEM string representing the Title of a button
|
||||||
/// @param i index of the error - obtained by calling PrusaErrorButtons + extracting low or high nibble from the Btns pair
|
/// @param i index of the error - obtained by calling PrusaErrorButtons + extracting low or high nibble from the Btns pair
|
||||||
const char * const PrusaErrorButtonTitle(uint8_t bi);
|
const char * PrusaErrorButtonTitle(uint8_t bi);
|
||||||
|
|
||||||
/// @returns pointer to a PROGMEM string representing the "More" button
|
/// @returns pointer to a PROGMEM string representing the "More" button
|
||||||
const char * const PrusaErrorButtonMore();
|
const char * PrusaErrorButtonMore();
|
||||||
|
|
||||||
/// Sets the selected button for later pick-up by the MMU state machine.
|
/// Sets the selected button for later pick-up by the MMU state machine.
|
||||||
/// Used to save the GUI selection/decoupling
|
/// Used to save the GUI selection/decoupling
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ static const char * const progressTexts[] PROGMEM = {
|
||||||
_R(MSG_PROGRESS_FEED_FSENSOR)
|
_R(MSG_PROGRESS_FEED_FSENSOR)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * const ProgressCodeToText(uint16_t pc){
|
const char * ProgressCodeToText(uint16_t pc){
|
||||||
// @@TODO ?? a better fallback option?
|
// @@TODO ?? a better fallback option?
|
||||||
return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
|
return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
|
||||||
? static_cast<const char * const>(pgm_read_ptr(&progressTexts[pc]))
|
? static_cast<const char *>(pgm_read_ptr(&progressTexts[pc]))
|
||||||
: static_cast<const char * const>(pgm_read_ptr(&progressTexts[0]));
|
: static_cast<const char *>(pgm_read_ptr(&progressTexts[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace MMU2
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,6 @@
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
const char * const ProgressCodeToText(uint16_t pc);
|
const char * ProgressCodeToText(uint16_t pc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,10 @@ DecodeStatus Protocol::DecodeRequest(uint8_t c) {
|
||||||
rqState = RequestStates::Code;
|
rqState = RequestStates::Code;
|
||||||
return DecodeStatus::MessageCompleted;
|
return DecodeStatus::MessageCompleted;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
requestMsg.code = RequestMsgCodes::unknown;
|
||||||
|
rqState = RequestStates::Error;
|
||||||
|
return DecodeStatus::Error;
|
||||||
}
|
}
|
||||||
default: //case error:
|
default: //case error:
|
||||||
if (IsNewLine(c)) {
|
if (IsNewLine(c)) {
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
const char * const ProgressCodeToText(uint16_t pc); // we may join progress convertor and reporter together
|
const char * ProgressCodeToText(uint16_t pc); // we may join progress convertor and reporter together
|
||||||
|
|
||||||
void BeginReport(CommandInProgress cip, uint16_t ec) {
|
void BeginReport(CommandInProgress /*cip*/, uint16_t ec) {
|
||||||
custom_message_type = CustomMsg::MMUProgress;
|
custom_message_type = CustomMsg::MMUProgress;
|
||||||
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndReport(CommandInProgress cip, uint16_t ec) {
|
void EndReport(CommandInProgress /*cip*/, uint16_t /*ec*/) {
|
||||||
// clear the status msg line - let the printed filename get visible again
|
// clear the status msg line - let the printed filename get visible again
|
||||||
custom_message_type = CustomMsg::Status;
|
custom_message_type = CustomMsg::Status;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ void MMU2Serial::flush() {
|
||||||
// @@TODO - clear the output buffer
|
// @@TODO - clear the output buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MMU2Serial::write(const uint8_t *buffer, size_t size) {
|
void MMU2Serial::write(const uint8_t *buffer, size_t size) {
|
||||||
while(size--){
|
while(size--){
|
||||||
fputc(*buffer, uart2io);
|
fputc(*buffer, uart2io);
|
||||||
++buffer;
|
++buffer;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
void close();
|
void close();
|
||||||
int read();
|
int read();
|
||||||
void flush();
|
void flush();
|
||||||
size_t write(const uint8_t *buffer, size_t size);
|
void write(const uint8_t *buffer, size_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MMU2Serial mmu2Serial;
|
extern MMU2Serial mmu2Serial;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue