Display for Laser/CNC mode


as we don´t use temperatures in laser/cnc mode i want to display coords instead of them.
we show real coords actual(call them machine coords)  and i want to show the coords changed
by G92 (call them workpiece coords) instead of the temperatures.

what should i take care of? is it a "simple" UI change or some more?



  • You need to change uimenu resp. in translations the lines for the start screen.

    Furthermore there is a converter function parse in ui.h that converts all the %xx tags to meaningful values. I think you need to introduce 3 more for these coordinates so you can use them in the menu strings.

  • Hi ,
    i´m working on that now, but i´m not shure about the%xx tags.
    there are many of them explained but commented and i cannot find how they work.
    if i´m correct generating 3 more means to modify the parse function and also add 3 more in uilang etc?
  • It is only adding more cases in

    void UIDisplay::parse(const char *txt,bool ram)

    uilang has nothing to do with it. Of course, if you want to use them you might need to add new menu entries with these codes and if they should be translateable you also need new entries for that in uilang.

    parse takes the original string and just replaces the %xx tags with a dynamic value.

  • edited December 2016
    digging out that stuff again....
    figured out now , but i still have two problems :

    1st: i can´t get rid of the  marked signs (see picture)

    2nd: i added a second set of strings  original: UI_TEXT_MAINPAGE6_1_ID (for FFF)  
                                                          second :UI_TEXT_MAINPAGE6_1_C_ID(for CNC and Laser mode)

    is there a possibility to switch over strings in mainpage depending on printer mode?
    something like:
    if (Printer::mode == PRINTER_MODE_FFF)



    it doesn´t work that way as the strings are selected in preprocessing , hope you find time to guide me      
  • Ok, found that Symbols , also managed to deactivate for CNC and Laser mode,
    still hanging on second point from above
  • Have a look at void UIDisplay::refreshPage()
    The dev version now already has
        if(menuLevel == 0) // Top level menu
            if(menuPos[0] == 0 && Printer::isPrinting()) {

    which is one special case. You could add more cases there. The menu you want to change is menuLevel==0 menuPos[0] == 0. 

    I also think I would need to add menu modes for the printer modes to change menu structure accordingly.
  • edited December 2016
    OK,that´s where i deactivated the symbols.
    what do you mean with menu modes ?

    So it´s time to say " Thank you so much for support in 2016"

    and my best wishes to you and your family for 2017 .

  • In dev is now a new doc in doc folder describer how menus work. We can have filters to show/hide menu parts with a mode flag. I think adding the print mode would be a good idea to disable e.g. extrusion entries in Laser/CNC mode.
  • first of all happy new Year!

    principially i agree with you, but as i want to change only main page i wrote some placeholders to generate the
    complete strings for line 1 to 3 in UIDisplay::parse.
    looks like the result i wanted, but still is not perfect , hope i can finish in original behavior the next days.
    momentarily code looks like this, (sensor defect and heater decoupling message is not yet implemented):

    else if(c2=='6')
                        if(Printer::mode ==PRINTER_MODE_FFF)
                        fvalue = Extruder::getHeatedBedTemperature();
                        fvalue = heatedBedController.targetTemperatureC;
                        addStringP(" Y:");
                        fvalue = Printer::realYPosition();
                        fvalue = Printer::currentPosition[Y_AXIS]+Printer::coordinateOffset[Y_AXIS];
                        addStringP("   Y:");
                        fvalue = Printer::realYPosition();

    I also want to keep the extrusion entries for the moment as i´m planning to have 4th axis in cnc/laser mode.
    Thanks for all your help last year and i hope ican count on future help for this year, you really do a great

    I´ll also finish my hardware soon ,prototype is running since 6 months without a problem.
    Are you interested in hardware stuff also?
    I´ts  a shield useable for due and mega working up to 40V , 6 pololu slots onboard
    features like mosfets (up to 16) are on a separate board to keep high current stuff away from
    "sensitive" parts.

  • While I'm always interested in hardware I normally have no time to play with it. I'm completely busy with handling the prebuild hardware and development.

    You solution will work I guess also not what I meant. My idea was to replace the 6 lines predefined for page 0 with some other 6 lines if in cnc mode.

    I have implemented the flags for cnc/laser for next update already. That allows to enable/disable some menu entries depending on mode. I think over time it will be integrated more and more.
  • I went that way because i was not  able to follow up the Guide ....

    found just filters for 4line  and 2 line pages including Actions but nothing i can use for 6-line pages with filter.

    so my programming abilities are only "for home use" may be i just don´t understand how it works.

  • The start pages can not use filters at all. It is only possible in the menu system to filter entries.
    What I mean is in refreshPage in case level 0 /Page 0 you can replace the part converting the strings to 6 lines in ram with your own conversion for that special case. So it will not convert the default 6 lines but the one you want to see. Similar like your solution now just that you change the complete line instead of a placeholder.
  • OK,

    just for understanding , i have 2 sets of lines , for example set 1 ID from 200 to 205   and set2 ID from 250 to255

    can i do something like adding just an Offset of 50 in case of laser/cnc  ?

    think it should be done here , but i don´t understand where....

    if(menuLevel == 0) // Top level menu
    UIMenu *men = (UIMenu*)pgm_read_word(&(ui_pages[menuPos[0]]));
    uint16_t nr = pgm_read_word_near(&(men->numEntries));
    UIMenuEntry **entries = (UIMenuEntry**)pgm_read_word(&(men->entries));

  • Think i understood now...

    - generate a case           

    if(menuPos[0] == 0 &&( Printer::mode ==PRINTER_MODE_CNC)) {

                col = 0;
                r = 0;
                if(UI_ROWS > 2) {
                    text = (char*)Com::translatedF(UI_TEXT_.........);

    and so on

    is that what you ment?

  • edited January 2017
    OK, got it.
    Shame on me , had not latest dev version thats why i couldnt see newest menu structure.
    so please mark this task as ANSWERED.

    If you are still interested in Laser Warmup , Laser safety door (it´s different from the door included in dev version)
    and Implementation of M6 for tool change i can start a pull request hopefully after next weekend

    (just need to implement my features in new dev version]
  • Yes, I think the features would be valueable to some users if they play well with existing firmware.

    I'm also working on dev firmware currently but think it will now only change at some points not used by you, se merging should be possible if you do it against current dev version.
  • edited January 2017
    compiling original dev version(DUE) with arduino 1.8.0 gave
    error message:
    exit status 1
    'zBabystepsMissing' is not a member of 'Printer'
    (disappears when activating babysteps)

    so i implemented most of my features now but
    new communication makes my "terminal" with second arduino not work so i tried to compile with
    gave error message:
    exit status 1
    'flashSource' was not declared in this scope

    i also work with some kind of "macros" just to execute commands without the need of generating uiactions
    worked up to dev version of end december 2016
    i use following declaration:
    #define UI_MACRO_BUTTON_LOW(pin,macro) if(READ(pin)==0) GCode::executeFString(PSTR(macro));

    which now generates following error:

    exit status 1
    incomplete type 'GCode' used in nested name specifier

    any Idea about that ?
  • The problem with babysteps I also detected yesterday and am working on a fix.

    Old communication does not work as you have seen. flashSource requires the new method as it is th eonly one implementing it.

    The macro seems to be used before GCode is included I guess so compiler does not know how to compile this. Put it in a cpp file as function and it should work.
  • Thanks, I´ll try that .

    If you find some time can you please Show me up how new communication works?

  • New communication is the same as old but has a handler per connection that stores per connection data like last line number. That allows us to have equal rights for 2 serialconnections + sd print + flash print and can easily extended to even more connections. Normally you have not to consider anything, but there are flags to write to all connection. This is important for values changed so all connected hosts can see the change. Other things like "ok" are only send to active connection. That is what makes it new, this selective returning of messages and multiple channels.
  • Thanks,

    so what if i just want to recieve some ASCII commands without line number from a Serial Connection?

  • Just don't add line numbers to the command. You can also omit checksums. If you have e.g. some longer gcode you put in flash it also has no line numbers/checksums. Only once you start using line numbers with checksums you need to use checksums on line number I think.
  • OK , back to error message

    exit status 1
    incomplete type 'GCode' used in nested name specifier

    if i uncomment "include "gcode.h" in ui.h which should solve that Problem

    i get following:

    In file included from sketch\ui.h:22:0,

                     from sketch\Repetier.h:611,

                     from sketch\BedLeveling.cpp:107:

    gcode.h:33: error: expected class-name before '{' token

     class SerialGCodeSource: public GCodeSource {


    gcode.h:47: error: expected class-name before '{' token

     class SDCardGCodeSource: public GCodeSource {


    gcode.h:59: error: expected class-name before '{' token

     class FlashGCodeSource: public GCodeSource {


    In file included from sketch\ui.h:22:0,

                     from sketch\Repetier.h:611,

                     from sketch\BedLeveling.cpp:107:

    gcode.h:317: error: 'GCodeSource' does not name a type

         GCodeSource *source;   


    exit status 1
    expected class-name before '{' token

    seems to be an issue, , any idea about that?

  • edited January 2017

    commented "include "gcode.h" in ui.h again and  Playing around  found that it´seems to be no more possible to use

    functions from GCode::     in uiconfig

    for example:

    switch (keymask1) {
          case 0xFFFE://1
                         GCode::executeFString(PSTR("M117 moveXY + manual"));

    not happy about that, as it was a simple possibility to execute something without

    generating ui_Actions.

    is there a way to solve that ," issue" seems to be based on new communication

    or can you please guide me a way to execute strings?

  • edited January 2017

    i uploaded my changes to my Github account .


    feel free to pick what you think to be useful.
    all changes marked clearly with //####RAyWB
    Base: development branch January 7 2017
    Features :

    Laser Safety door ,Laser warmup , M6 Tool change , Z-probe added to menu,
    Menu shows G92 coords instead of temp in CNC/Laser Mode...

    i uploaded only DUE version as i´m running low on Time (went back to finishHardware)
  • as i cleanup my code shifting my user defined actions to "custom events" i found it doesn´t compile
    until i add  #include"CustomEvents.h"  to uiconfig.h

    i uncommented #define CUSTOM_EVENTS in configuration so i think it should work without #include"CustomEvents.h"  to uiconfig.h

    any idea?
  • Maybe you are mixing implementations.
    CustomEvents.h has only declarations and defines your functions as external. The real implementation is in CostomEventsImpl.h which is called after including everything, so you should be able to use anything there.

    I already downloaded your code but still have to fix some parts until I can see/merge it.
  • I´m not shure about that.
    for crosstest i took example from Sample Event Systems\FELIX Pro 1.(took CustomEvents.h and CustomEventsImpl.h)

    just enabled custom events and tried to use one function as :  UI_KEYS_BUTTON_LOW(UI2_BUTTON,UI_ACTION_XY1_BACK);

    UI_ACTION_XY1_BACK is declared in CustomEvents.h (#define UI_ACTION_XY1_BACK     1500).

    got error message from Compiler:

    exit status 1
    'UI_ACTION_XY1_BACK' was not declared in this scope

    if i add

    #if defined(CUSTOM_EVENTS)
    #include "CustomEvents.h"

    to top of ui.h this message disappears , but lots of other errors come up so i stopped searching.

    hope you´ll find the time and try to use the felix event system from examples, think it needs some work.

    for me and my event system adding :

    #if defined(CUSTOM_EVENTS)
    #include "CustomEvents.h"

    to top of ui.h makes everything work as expected.

  • I had similar problems and recently moved includes. Current position is
    CustomEvents.h is last thing included in repetier.h and CustomEventsImpl.h are last in ui.cpp so it can reference all ui related stuff only defined in that file. I guess you are using a older dev version.
  • edited January 2017
    hmm, wonder about that
     i use development version downloaded january 7th and yes,CustomEvents.h is last thing included in repetier.h and CustomEventsImpl.h are last in ui.cpp.
    i use UICONFIG_CONTROLLER  is that the cause?

Sign In or Register to comment.