Merge pull request #3639 from wavexx/cleanup_warnings

Cleanup warnings
This commit is contained in:
Yuri D'Elia 2022-09-30 15:19:42 +02:00 committed by GitHub
commit 0ffd33c142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 24 deletions

View File

@ -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() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { return voltRaw; }
uint16_t ret;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ret = voltRaw; }
return ret;
}
const char *IR_sensor_analog::getIRVersionText() {
@ -339,7 +341,9 @@ bool IR_sensor_analog::checkVoltage(uint16_t raw) {
}
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(){

View File

@ -380,6 +380,8 @@ bool MMU2::set_filament_type(uint8_t index, uint8_t type) {
return false;
// @@TODO - this is not supported in the new MMU yet
index = index; // @@TODO
type = type; // @@TODO
// cmd_arg = filamentType;
// command(MMU_CMD_F0 + index);

View File

@ -279,9 +279,8 @@ private:
/// unlike the mid-print ToolChange commands, which only load the first ~30mm and then the G-code takes over.
bool loadingToNozzle;
uint8_t retryAttempts;
bool inAutoRetry;
uint8_t retryAttempts;
};
/// following Marlin's way of doing stuff - one and only instance of MMU implementation in the code base

View File

@ -132,24 +132,24 @@ uint16_t PrusaErrorCode(uint8_t i){
return pgm_read_word(errorCodes + i);
}
const char * const PrusaErrorTitle(uint8_t i){
return (const char * const)pgm_read_ptr(errorTitles + i);
const char * PrusaErrorTitle(uint8_t i){
return (const char *)pgm_read_ptr(errorTitles + i);
}
const char * const PrusaErrorDesc(uint8_t i){
return (const char * const)pgm_read_ptr(errorDescs + i);
const char * PrusaErrorDesc(uint8_t i){
return (const char *)pgm_read_ptr(errorDescs + i);
}
uint8_t PrusaErrorButtons(uint8_t 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
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);
}

View File

@ -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
/// @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
/// @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
/// @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
/// @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
const char * const PrusaErrorButtonMore();
const char * PrusaErrorButtonMore();
/// Sets the selected button for later pick-up by the MMU state machine.
/// Used to save the GUI selection/decoupling

View File

@ -62,11 +62,11 @@ static const char * const progressTexts[] PROGMEM = {
_R(MSG_PROGRESS_FEED_FSENSOR)
};
const char * const ProgressCodeToText(uint16_t pc){
const char * ProgressCodeToText(uint16_t pc){
// @@TODO ?? a better fallback option?
return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
? static_cast<const char * const>(pgm_read_ptr(&progressTexts[pc]))
: static_cast<const char * const>(pgm_read_ptr(&progressTexts[0]));
? static_cast<const char *>(pgm_read_ptr(&progressTexts[pc]))
: static_cast<const char *>(pgm_read_ptr(&progressTexts[0]));
}
} // namespace MMU2

View File

@ -4,6 +4,6 @@
namespace MMU2 {
const char * const ProgressCodeToText(uint16_t pc);
const char * ProgressCodeToText(uint16_t pc);
}

View File

@ -112,6 +112,10 @@ DecodeStatus Protocol::DecodeRequest(uint8_t c) {
rqState = RequestStates::Code;
return DecodeStatus::MessageCompleted;
}
} else {
requestMsg.code = RequestMsgCodes::unknown;
rqState = RequestStates::Error;
return DecodeStatus::Error;
}
default: //case error:
if (IsNewLine(c)) {

View File

@ -11,14 +11,14 @@
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;
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
custom_message_type = CustomMsg::Status;
}

View File

@ -19,7 +19,7 @@ void MMU2Serial::flush() {
// @@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--){
fputc(*buffer, uart2io);
++buffer;

View File

@ -12,7 +12,7 @@ public:
void close();
int read();
void flush();
size_t write(const uint8_t *buffer, size_t size);
void write(const uint8_t *buffer, size_t size);
};
extern MMU2Serial mmu2Serial;