prusa3d / Prusa-Firmware

Firmware for Original Prusa i3 3D printer by PrusaResearch
GNU General Public License v3.0
2.02k stars 1.05k forks source link

[BUG] Nozzle settings label and values do not match in ultralcd.cpp #4581

Closed rw3iss closed 8 months ago

rw3iss commented 8 months ago

Printer type - MK3S+ Printer firmware version - 3.13.2

Describe the bug I noticed while editing the firmware to add more nozzle sizes to the settings... that the existing setting values do not match their labels! I suspect because this setting value isn't actually used anywhere (hopefully)?

To Reproduce See lines 4242+ in ultralcd.cpp.

Expected behavior The values should match the labels from the switch statement.

Notice the mismatching value settings according to the given switches. This looks totally wrong, but maybe I'm missing something. Are these settings used at all?

static void lcd_nozzle_diameter_cycle(void) {
    uint16_t nDiameter;
    switch(oNozzleDiameter){
    case ClNozzleDiameter::_Diameter_250:
        oNozzleDiameter=ClNozzleDiameter::_Diameter_400;
        nDiameter=400;
        break;
    case ClNozzleDiameter::_Diameter_400:
        oNozzleDiameter=ClNozzleDiameter::_Diameter_600;
        nDiameter=600;
        break;
    case ClNozzleDiameter::_Diameter_600:
        oNozzleDiameter=ClNozzleDiameter::_Diameter_800;
        nDiameter=800;
        break;
    case ClNozzleDiameter::_Diameter_800:
        oNozzleDiameter=ClNozzleDiameter::_Diameter_250;
        nDiameter=250;
        break;
    default:
        oNozzleDiameter=ClNozzleDiameter::_Diameter_400;
        nDiameter=400;
    }
    eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter);
    eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
}

I will try and submit a PR soon.

rw3iss commented 8 months ago

Whoops, realizing that's because it is supposed to cycle. Was wondering why the values weren't changing when hitting the button 😄👌