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?



  • Posts: 0
    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.

  • Posts: 345
    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 Posts: 345
    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      
  • Posts: 345
    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 Posts: 345
    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.
  • Posts: 345
    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.

  • Posts: 0
    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.
  • Posts: 345

    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.

  • Posts: 0
    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.
  • Posts: 345


    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));

  • Posts: 345

    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 2 Posts: 345
    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]
  • Posts: 0
    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 3 Posts: 345
    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 ?
  • Posts: 0
    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.
  • Posts: 345

    Thanks, I´ll try that .

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

  • Posts: 0
    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.
  • Posts: 345


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

  • Posts: 0
    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.
  • Posts: 345

    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 5 Posts: 345

    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 8 Posts: 345

    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)
  • Posts: 345
    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?
  • Posts: 0
    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.
  • Posts: 345
    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.

  • Posts: 0
    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 11 Posts: 345
    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?

  • Posts: 345
    did some more tests,just try to use one of the uiactions from CustomEvents.h, think you´ll also get error message

    here´s my CustomEvents.h:

    #ifndef _CustomEvents_H
    #define _CustomEvents_H

    extern int cExecute(int action,bool allowMoves);

    #define EVENT_UI_EXECUTE(action,allowMoves) cExecute(action,allowMoves)

    #define UI_ACTION_X_UP1                  1500
    #define UI_ACTION_X_DOWN1                1501


    and this is my CustomEventsImpl.h :

    #ifndef _CustomEventsImpl_H
    #define _CustomEventsImpl_H

    int cExecute(int action,bool allowMoves) {
      switch(action) {
            case UI_ACTION_X_UP1:
            case UI_ACTION_X_DOWN1:
                if(!allowMoves) return action;
                PrintLine::moveRelativeDistanceInStepsReal(((action == UI_ACTION_X_UP1) ? 1.0 : -1.0) * Printer::axisStepsPerMM[X_AXIS], 0, 0, 0, JOGRATE, false,false);



    if i don´t use one of these actions it compiles, but if i use them for example
    i get error message until i insert

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

    to top of ui.h.

    same behavior when i select different controller (so my uiconfig doesn´t matter)
    may be you find the time to have a look at it
  • Posts: 345
    also tried arduino 1.6.6 and 1.6.8 , doesn´t change , actually work with 1.8.0.
    is there anything else i can do for checking?
  • Posts: 0
    I see the problem and will hopefully post a update on github today that fixes it.

    Problem is you are using part of your custom file before it is included. Your solution is not really good as you now include it much too early so not everything you might need is defined.

    My solution is to move some more stuff to DisplayList.h which was in ui.h and put that part after the include of CustomEvents.h so you can use the defines in display definition.
  • edited January 12 Posts: 345
    ok, thanks for support, so i guess the felix event system works as it uses the additional defines later on via menu?
    so i don´t have a felix printer and also don´t know about the hardware inside.
    may be you can explain a little 
  • Posts: 0
    Ok, latest update should now allow compiling without special tricks.
  • Posts: 345
    Ok, I already downloaded ;-)
  • Posts: 0
    You need new config to compile - added some new params for preheating.
  • Posts: 345
    Thanks, i´ll just merge my setup into new config
  • edited January 14 Posts: 345
    Nice !
    No Tricks necessary to compile :-)
    During merging my adds i  found German translation " Kontrolle" for "control" , i think "Steuerung" would be better translation.
    " Kontrolle" in my understanding happens after a finished action.Anyway, that´s peanuts.

    You once more did a amazing job !

    so i can continue playing around with that stuff , I´ll concentrate to the Customevent system now , think using that will make my life easier
  • Posts: 0
    You are right, Steuerung matches much better.

    Yes event system is what everyone should use to extend functions so updating is easy. If there are hooks missing it is easy for me to add them. I think the Felix shows nicely what is possible now. Even new menu with translations are now possible:-) But that is a bit of a pain as you never see new menu entries. But still better then always putting your changes to updates.
  • Posts: 0
    Ok, have now merged some of your improvements namely laser warmup and door handling.

    I don't see why you introduced another door handler for this, so I modded it to use normal door already predefined to disable laser faster. Hope it works.

    I also modified the laser warmup a bit to make it work more general, but the main parts stay the same. Could you check if it is working as I have no laser with a delay I would notice.
  • edited January 31 Posts: 345
    Simple reason for second door handler is if safety door is for example just a cover with a switch on Laser Toolhead
    and has nothing to do with machine housing.
    it´s let´s say for more professional use as it´s a safety switch assigned to laser , not to machine itself.
    So it makes easy to meet "Maschinenrichtlinie".
    As result you have one door switch for machine (might be useful for FFF for printing ABS or other high warping
    materials)  and one for laser toolhead.
    Checking will take some time , hopefully next weekend
  • edited February 1 Posts: 345
    So i found time to do some tests in breadboard setup.

    Laser Warmup is not working as it should, it works as delay, moves and laser start at same time.
    (just set warmup time to 1000 , so you can see that clearly)

    Door " works" if you mean disabling laser immediate, but i miss message in display and also to host
    that door is open.
    As door is active in all modes i´m not happy with that. basic idea was just for laser mode and as i wrote above
    that was the reason i introduced a second "door" declared as laser safety door.
    For CNC  the door funktion should allow moves in order to adjust workpiece coordinates it should just block spindle enable.
    And for FFF , how to change filament with closed door or otherwise how to feed filament when door open and no moves allowed?

    so to be honest for me the new door function is not practicable, may be we should keep the second one just for laser.

    what do you mean?

  • edited February 1 Posts: 345
    found bug with delay : (twice in motion.cpp)

                      //LaserDriver::changeIntensity(cur->secondSpeed); //doesn´t work this way
                      LaserDriver::changeIntensity(255); // need to switch laser on during warmup
  • Posts: 345

    Did you also take a look at the Display regarding workpiece coords(including G92 Offsets) for cnc and laser

    instead of temperatures?.

    i introduced 3 placeholders, translations etc. are done.

    would be nice to have it implemented as i can´t manipulate UIDisplay::refreshPage() update from custom Event.

    may be we can do it as Feature, something like #define Feature_WorkpieceCoord

    to activate that

  • Posts: 0
    I think for laser/cnc it is more common to use offset coordinates as you need to calibrate object position with G92. So I think we can switch to offset coordinates in cnc/laser mode so it appears for x/y.

    We now also have filters for different modes
    #define MENU_MODE_FDM 128
    #define MENU_MODE_LASER 256
    #define MENU_MODE_CNC 512

    only problem is default pages do not support them as they are not menus and always have a fixed size so disablinga line is not an option here.
  • edited February 2 Posts: 345

    may be you misunderstood, so may be you find the time to take a look at the UIDisplay::refreshPage()  you downloaded from my site.

    that works fine and coords are shown as wanted.even Z is important as in CNC often workpiece height is set to 0.

    (when milling pockets for example).

    Any thougts to my comments regardin implemntation of door and laser warmup from my previous Posts?

  • Posts: 0
    Just changed %x0-2 to G92 coordinates for laser/cnc so it appears everywhere in that coordinate system, also in move xyz.

    I see now you have replaced the extruder/bed place with Xw/Yw/Zw (why w?) Might be an idea to have both on startscreen and G92 modded everywhere as this is more helpfull after calibration.

    Have reset power to 255. Since it is really warmup it should maybe really in full power until the move sets it back to correct power.

    Door seems difficult since it depends on printer type and user wishes. I know printer vendors wanting to disable everything if door goes open. Also stopping moves and not only stopping spindle would often seen as good idea, but making movements impossible might sometime be a problem. Ans some printers need open case to change filament, others not. So for perfect fit we need 3-6 extra config parameters to define how door should operate under which conditions. Not what I really like as users already find we have too many options.
  • edited February 2 Posts: 345
    Yes, thats what i wanted to have , left side G92 coords and right side machine coordinates.
    just like "real" cnc machines mostly have.
    that´s why i added %x5-7.

    and you´re right door implementation is mostly point of view, so what about something like shifting door
    to event system, just have no idea how to realize.
    for me it´s ok to have it , anyway i can change or add my own version .
    so as your code is much more efficient as mine i´ll follow your example.

    As i read in posts from other users pwm for drivers is wanted sometimes, and i know
    we are limited on timers.
    Im working on external PWM, have it running already (and yes, i made that in Event System :-)  )
    I´ts  a buyable module based on TLC 5947 which gives 24 free running pwm´s in 12bit resolution.

    so it would give capability for easy laser and spindle control and may be also useful for the guys
    playing around with led stuff.
    For myself I´ll use it for step down voltage conversion , trying to get real dc voltage for Fans

  • Posts: 345
    I see now you have replaced the extruder/bed place with Xw/Yw/Zw (why w?) Might be an idea to have both on startscreen and G92 modded everywhere as this is more helpfull after calibration.

    BTW, the "w"  is for work coordinates  .

Sign In or Register to comment.