Repetier Firmware on MKS GEN L

Hello, I am replacing my melzi board with an MKS GEN L V2.0.

I used the old firmware and so far I just edited the pins for the LCD.

I received this error:

uint8_t entType = HAL::readFlashByte((const prog_char*)&(ent->menuType));

found ui.cpp.

What does this code mean?

Thanks





«1

Comments

  • You omitted the error message. The line reads the menu type from flash memory.
  • edited September 2020
    THis is the error:

    ui.cpp:2124:43: error: expected ')' before 'const'
    exit status 1
    expected primary-expression before 'const'


  • Which firmware version are you compiling here with which arduino version? Current version does not have that line at 2124. Actually it doe snot contain it at all. And old firmware versions are not compatible with latest arduino ide/compiler.
  • edited September 2020
    the firmware version is 0.92 - I see this in the configuration file

    This firmware is for the Afinibot A3 printer. I found the stock firmware online. I m trying to get the old firmware onto to mks gen (as I said before) and then just change the pins for the LCD. Hopefully getting it working like the original
  • For 0.92 I would try using arduino ide 1.0.x - I think that was the active version when it was developed.
    Or you upgrade to recent version then you can use latest arduino ide. You can normally do this easily leaving all new settings to default value and just copy the one from your existing configuration.
  • edited September 2020
    Ok so when I use arduino ide 1.0 i get this error:

    /motion.h: In member function 'void PrintLine::startYStep()':
    motion.h:540: error: 'DIO22_WPORT' was not declared in this scope
    motion.h:540: error: 'DIO22_PIN' was not declared in this scope
    motion.h:540: error: 'DIO22_WPORT' was not declared in this scope
    motion.h:540: error: 'DIO22_PIN' was not declared in this scope

    So instead, I tried upgrading the firmware with the firmware configuration tool. The code compiles but nothing displays on the  LCD screen. I changed the pin numbers but I still get nothing. This is for the Zonestar LCD (has 5 buttons). I am guessing that there is code in the old firmware that the new firmware is lacking.

    Am I right? what files should I look at?

  • Not necessarily. Did you select the Zonestar display with 5 buttons in the user interface section? They had a special handling for the 5 buttons as they are controlled by one ADC value. You also need to set the analog pin in that case but that should also be set in the original config.
  • what line do I edit and what file?
  • The one containing FEATURE_CONTROLLER in configuration.h controls that. But I was assuming you used the configuration tool to make it easy. There you also see below description the define names in configuration.h
  • Where do you select the zonestar display? which file and line should i Look for?
  • Look at my last answer! Lines differ but there is only one line with FEATURE_CONTROLLER in configuration.h
  • Sorry, mustve missed that. But yes i did use the configuration tool and it is configured to 24 for the zonestar display.
    But I am still not seeing anything come up on the display.
  • edited September 2020
    I configured the pins from this picture I got from another discussion. still no luck



  • Looks like the lowe rimage is rotated 180° compared to top one. The keys come from an analog input so that would be the ADC marked pin I guess which would be D37 in upper image. You need to enter an analog pin number here. Problem is D37 is not an analog pin so there does no analog pin exist. So the display can not work with this connector. You need to redirect the ADC pin to an analog input pin. If you search for arduino 2560 pinout you get lots of images showing which pins have analog equivalent for digital pins.
  • OK, so when I assign the ADC pin to analog pin 4, I use the code "#define ADC_KEYPAD_PIN" , which is the equivalent but the buttons arent triggering anything.

    Mega 2560 R3 with ATmega16U2 USB - ProtoSupplies
    On a side note, I was able to get the display working, the buttons just aren't working

    What else could be the issue?


  • So you had
    #define ADC_KEYPAD_PIN 4
    which is equivalent to D58 just as analog input?

    Guess you already say in DisplayList.h this section:

    #if FEATURE_CONTROLLER == CONTROLLER_ZONESTAR

    // Keypad
    #if !defined(ADC_KEYPAD_PIN) || (ADC_KEYPAD_PIN < 0)
    #error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h

    // This must be defined in the Configuration.h since used in ADC tables
    //#define ADC_KEYPAD_PIN 1 // A1 (D30, analog numbering)

    // Display
    // Define UI_DISPLAY_TYPE = DISPLAY_SR with pins to override default settings
    // that work for original Zonestar hardware.
    // For instance:
    // #define UI_DISPLAY_TYPE DISPLAY_SR
    // #define UI_DISPLAY_DATA_PIN 29
    // #define UI_DISPLAY_CLOCK_PIN 28
    // #define UI_DISPLAY_ENABLE_PIN -1 // for 2-wire or pin number for 3-wire
    #undef UI_DISPLAY_TYPE
    #define UI_DISPLAY_TYPE DISPLAY_4BIT

    #if MOTHERBOARD == 39 // ZRIB
    #define BEEPER_TYPE 1
    #define UI_DISPLAY_RS_PIN 16
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_ENABLE_PIN 17
    #define UI_DISPLAY_D4_PIN 23
    #define UI_DISPLAY_D5_PIN 25
    #define UI_DISPLAY_D6_PIN 27
    #define UI_DISPLAY_D7_PIN 29
    #define UI_RESET_PIN 41

    #elif MOTHERBOARD == 703 // MEGATRONICS 3

    #define UI_DISPLAY_RS_PIN 32
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_ENABLE_PIN 31
    #define UI_DISPLAY_D4_PIN 14
    #define UI_DISPLAY_D5_PIN 30
    #define UI_DISPLAY_D6_PIN 39
    #define UI_DISPLAY_D7_PIN 15
    #define BEEPER_TYPE 1

    #elif MOTHERBOARD == 63 // Melzi

    #define UI_DISPLAY_ENABLE_PIN 29
    #define UI_DISPLAY_RS_PIN 28
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_D4_PIN 10
    #define UI_DISPLAY_D5_PIN 11
    #define UI_DISPLAY_D6_PIN 16
    #define UI_DISPLAY_D7_PIN 17
    #error Unknown display - board combination. Please add your pin mapping in DisplayList.h

    #define UI_DISPLAY_CHARSET 1
    #define UI_COLS 20
    #define UI_ROWS 4

    // UI
    #define UI_HAS_KEYS 1
    #define UI_HAS_BACK_KEY 1
    #define UI_DELAYPERCHAR 50
    #define UI_INVERT_MENU_DIRECTION 1

    // Opportunity to override the Enter key via Configuration.h
    // By default it duplicates the Right key, but could be set to
    // anything else, e.g. UI_ACTION_TOP_MENU.
    #ifndef ADC_KEYPAD_CENTER_ACTION
    #define ADC_KEYPAD_CENTER_ACTION UI_ACTION_OK

    #ifdef UI_MAIN
    // Nothing to init since ADC is read in a loop if ADC_KEYPAD_PIN > -1
    inline void uiInitKeys() {}

    // Read and decode ADC keypad (fast reads)
    void uiCheckKeys(uint16_t &action) {
    struct {
    uint16_t min;
    uint16_t max;
    uint16_t action;
    } keys[] = {
    { 300, 500, UI_ACTION_BACK }, // Left
    { 570, 870, UI_ACTION_PREVIOUS }, // Up
    { 1150, 1450, ADC_KEYPAD_CENTER_ACTION }, // Center
    { 1900, 2200, UI_ACTION_OK }, // Right
    { 2670, 2870, UI_ACTION_NEXT } // Down
    };
    const uint8_t numOfKeys = sizeof(keys) / sizeof(keys[0]);

    extern volatile uint16_t osAnalogInputValues[ANALOG_INPUTS];
    uint16_t adc = osAnalogInputValues[KEYPAD_ANALOG_INDEX] >> (ANALOG_REDUCE_BITS);
    if (adc < 4000) {
    for (int8_t i = 0; i < numOfKeys; ++i) {
    if ((adc > keys[i].min) && (adc < keys[i].max)) {
    action = keys[i].action;
    return;
    }
    }
    }
    }

    // Read and decode ADC keypad (slow reads)
    inline void uiCheckSlowKeys(uint16_t &action) {}
    #endif // UI_MAIN

    #endif // CONTROLLER_ZONESTAR


    Which has no case for the mks board so guess you modified it to your pin numbers already. If the board works as I think with varying resistance you should see different adc values. You could add some test code to write the adc value to serial so you see it in your hosts console.

    After 
    uint16_t adc = osAnalogInputValues[KEYPAD_ANALOG_INDEX] >> (ANALOG_REDUCE_BITS);

    add
    Com::printFLN(PSTR("Key:"), (int32_t)adc);

    Then you see if it changes while pressing a key or not.

    Also make sure no function is using pin D58 for anything else or it might override it to digital function.
  • edited September 2020
    okay, I got it working. I realized I was using firmware for a different printer. Once I found the correct firmware I used the configuration tool and selected the ZOnestar LCD. Then I assigned the ADC to analog pin 4 and now it works.
    The screen and buttons now work.

    Thanks again for your help. I appreciate your patience.

    I have another question.

    My question is how do I enable dual z extrusion for an MKS Gen Board. Now usually you would check the 

    " Mirror motor signals to other stepper driver (FEATURE_TWO_ZSTEPPER) " box.

    But this just copies the ORIG_Z_STEP_PIN and etc., to the Z2_STEP_PIN

    This would be fine if I wired the stepper drivers to the same pins (am I right?) but I want to use the extra extruder socket instead.

    That means I need to send the commands of the ORIG pins to two different stepper motors that have their own unique ( step,dir,enable pins)

    How can I do this?



  • You select FEATURE_TWO_ZSTEPPER and you see a new option appear below: Mirror stepper socket
    Select the socket where the second driver is mounted to e.g. E1 or E2. That's all needed. All step signals will now also be send at same time to that driver.
  • Ok, I got it thanks.

    I am also up adding a geared extuder with a 3 to 1 ratio.

    Will just multiplying the steps per mm by 3 be enough? or does it need the extruder need to be recalibrated?

  • i have a problem with the z motors, One motor rotates more than the other one. I assumed it was the steps per mm so I changed it for the E0 but that didn't work?
  • Extruder needs recalibration if it is a new drive. Diameter of driver is also important so it might differ.

    For Z mirror both get same steps count. If they differ you normally have different microstepping configured on your board.
  • Ok, so I will have to calibrate the extruder. I got the z motors to move in sync once I gave them more power.
    But the movements are very choppy, this is probably because I haven't used any jumpers for micro-stepping.

    In the original code, the z steps per mm was 2560. What micro-stepping is this? I am using a498 stepper drivers. so I am assuming 1/16. Do you think this is right?
  • Yes with 1.25mm pitch I think that is 1/16 on 200 step motors. That is what you normally use. Makes moves also more silent.
  • After microstepping, none of my stepper drivers are working? Are they lacking power? I raised the Vref to 0.8 which is around 1.6 Amps
  • Changing microstepping does have any effect on power so that would be strange. When you enable printer make sure you can move all axes without big force. If one is blocked by motor it has set enable signal wrong and would disable power for moving instead. Would be only reason that they get no power at correct time.

    Also check in eeprom if all values for steps etc are valid values. NaN/Inf and eventually 0 can also prevent moves but motor would at least block then.
  • When I send the command, the steppers lock up. How do I check eeprom on repetier host?
  • In config menu is a eeprom editor which shows all values stored in eeprom.
  • ok, the values for the steps per mm are correct. They are the same as the values in the code. What is NaN/Inf?
  • NaN = Not a number
    Inf = Inifinite
    Sepecial binary values not mapping to a valid number and causing computations to fail if one of them has that value.
  • All the numbers seem reasonable not Nan or Inf. What else could lock up the steppers?
Sign In or Register to comment.