Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom firmware development
Ah okay, I know what you are talking about now. I get it once in awhile and just restart the machine.
Thanks for the code suggestions.
I am working on another solution so I don't have to switch the two extruders in the userpins.h. I am really close.

I have also been working on a new command that we can send to the printer and have it clean the nozzle(s). I am almost done with that as well.

But now I have a question that I need help with. When I set the Printer Bounds to a MAX depth to 200 (aka Y max value). Then I try to move along the X axis I get some really bad vibrations and many skipped steps. It seems to me like the motor is getting commands to step so quickly that is just shakes and goes nowhere. If I move back down to about 190 Y then the problem goes away. If I set the MAX depth to something like 250 then I can move along the X axis with it in the 200 Y position all day long. I have tried to set the STEPPER_HIGH_DELAY from 0 up to 200 and the DOUBLE_STEP_DELAY up to 200 but these had no affect. I think this is a firmware issue because I get the same thing happening at random when I am printing. All of a sudden a move on the X axis will just vibrate and stutter and then I have lost those steps.
I got this behaviour when extruder was switched by command but actually not really moved - and after I launched Y or Z movement - then the printer move very slowly trying to move and switch in same time so big vibration, not sure it is same as you. it happened 2 or 3 times during my tests.

- Actually after several change in code without changing pins I reverted because I felt that when extruder used for homing should be E0 (default) and the left one because in homing position switch extruder should be normal switch so just move to left, if right one is default one when homing - extrudeur cannot be switched until right one is first moved to 0,0 then sitch can be done, not so straight forward. so I use pin exchange with conditions to still keep compatible with 1.0 and also be sure E0 is selected for homing (userpins.h, configuration.h,printer.cpp), and code modifications are more light also to limit side effects.
I did several printing with both extruder 100% right, 100% left and dual extrusion - all are ok - I enclose my code and my settings ( I have Xoffset and Yoffset for extruder to get correct dual extrusion, may be not same as you ) all is centered on bed but Y is not fine tuned I have used for my calibration
- I have also including one fix from current repetier Github (extruder.cpp)
- One fix for the menu navigation : incrementing and decrementing values where upside down with arrows keys due to menu navigation making next key is down key and previous key is up. that was not consistent with value incrementation for me. (ui.cpp)
- I make home functions permanent, no show/hide filter as it make more sense for me - just personnal feeling (uimenu.h)
- I have added a heat bed character (same as others firmware like marlin) to simplify main screen by modifying printer ready special character which was not used in english.(character_bed in ui.cpp).
- I have changed UI_START_SCREEN_DELAY to 4000 as I have some white screen sometimes as suggested in forum.
- I have also implemented the Buzzer fix to get M300 commands back

- I plan to implement some command in GCODE to switch on/off/toggle the light
- If no activity I would like also to switch off light/LCD back light and resume light when button is pressed like in stock FW
- Implement cleaning nozzle fonction is also in my plan - I already do in my start/end GCODE

Please have a look and feel free to let me know if you find something

Thanks for your great help,

Edit : I also add my cura start/end GCode

Tried UI_START_SCREEN_DELAY 4000 yesterday and today I got a blank display after switching the printing on, so it doesn't seem to help much Sad
Quote:Tried UI_START_SCREEN_DELAY 4000 yesterday and today I got a blank display after switching the printing on, so it doesn't seem to help much Sad
Delay for LCD start up is in UI.cpp initializeLCD() for UI_DISPLAY_TYPE==1 & 2
around line 475, you will find the delay hard coded as 235 milliseconds.
For Da Davinc maybe take more time to reach 5V. Add more delay here should make it work.
Current setting is 0.235 seconds, I set mine to 0.4 seconds.
HAL::delayMilliseconds(400); // default 235
Usually I have LCD problem when I turn off printer for long time. The first time start it up LCD usually don't work.
This should fix it.

void initializeLCD()

    // according to datasheet, we need at least 40ms after power rises above 2.7V
    // before sending commands. Arduino can turn on way before 4.5V.
    // is this delay long enough for all cases??
    HAL::delayMilliseconds(400); // default 235
I think we need 2 sec because it's about that time on the original firmware
Quote:I think we need 2 sec because it's about that time on the original firmware
No we don't. UI_START_DELAY is different then the delay in initializeLCD().
2 seconds is way to long for LCD initialization. I use these LCD a lot in a project. Different LCD may need some extra 10-40 ms delay but not in seconds.
The UI_START_SCREEN_DELAY is different thing it just delay the LCD UI menu to show-up.
In small circuit the system will reach to 5V faster then the large circuit in Da Vinci's LCD with long cable. add extra 100ms should be enough.
Thank you, I've set mine to 400 ms as well, lets see how it goes!

Do you have any idea about the other issue, the display becoming garbled sometimes for no apparent reason?
You are wonderful! I can't believe how much were able to get done.

Since you have done so much other work as well I will just start using your work going forward. I have completed my Command that will clean the Nozzles. It can be activated by sending "M100". I had to make some changes to the Configuration.H file to get it to work.
#define ENDSTOP_Y_BACK_ON_HOME 7 //This makes the tool head bounce back 7mm after homing
#define X_MIN_POS -40 //This was already set in your EEProm but I think my cleaning command needed it to be set in the FW as well.

My new command.cpp and Configuration.H are attached.

Sadly, My vibration bug is still there even in your FW. It was strange. This morning instead of Vibrating. I would repeatedly send command to move +10 MM on the X - Axis. The Location Numbers in Repetier Host went up +10 with each click. But the Printer just kept moving the tool head back and forth 10mm at a time. So I think my bug has something to do with the X Stepper direction getting switched unexpectedly.
Hi AAryn,
Thanks a lot - I will test your code
But I have reviewed code and eeprom and I did not set #define X_MIN_POS -40 in my latest post exchanging pins, my latest solution use left extruder as 0,0 and home reference, can you confirm which code do you use ?

#define X_MIN_POS -40 make sense only if right extruder is the E0 and the reference for homing, so no pin exchange solution.
I do not see userpins.h in your zip so I just guess. I need to be sure to be able to use your code on correct solution

PS: about vibrations, did you test FW1.0 and doing a M502 / M500 commands to reset eeprom ? with all your tests you may mess up something somewhere - if no vibrations it will confirm this is FW or eeprom and not Hardware.- just my 2 cents

Thanks a lot,

Generally speaking, as Josh and I have discussed previously, the 0,0 position should be the primary extruder min x/min y on the print bed. Anything off the print bed should be "-" when moving towards the home position.

Keep up the work guys, this will likely make it far easier to update the 1.0 to dual extruder. I'm still gathering some parts for that experiment, just have had time with the computer crash and everything else going on...

Hi Keith,
yes as you can see in configuration.h in previous post , my primary extruder E0 (left) is the one on 0,0 on print bed (or almost) when home and my second extruder E1 (right) has negative offset
#define EXT1_X_OFFSET -2852, E1 is the one on right of print bed.
I also found using right extruder (the one outside of the bed) as reference was possible but it needed too many changes compare to the left extruder as first extruder.

Today my Davinci 2.0 is fully working from extrusion and position point of view with the fw I posted, now working on adding some stock fw fonctions which are missing in repetier fw, like cleaning nozzle and light management. they are nice to have functions I think.
Hi Aaryn,
I have slightly modified your code to be used if no home done, I have also used variable from eeprom instead of configuration.h for consistency and added also a menu on quick settings, code is based on left extruder is 0,0 and default one, I moved the code to a function to printer.cpp to use same function where ever it is called, I hope you do not mind.
I have also added a power saving fonction in Quick Menu to automaticaly switch off LCD back light and Light after a configurable time
Both new feature can be enable /disabled in configuration.h by setting 0 or 1


Powersaving Function:
there are several preset (off, 1 min, 5 min, 15 min, 30 min), default is 30min
This will switch off LCD back light and light if no key activity on keyboard after time defined
If keyboard is pressed, light will be back and timer is reset, I did not reset counter at the end of printing because I did not feel was necessary, but it can easily done.

Clean Nozzle Function:
It use M100 command as you defined or can be also launched from Quick Settings menu
It use XMIN,YMIN, XMAX(only for Davinci 2) values from eeprom to move.
It check if homing is done, if not, it do it
It save current extruder and position and restore after cleaning done.
It also check if Z position is at least at 15mm distance to avoid any accident with corners metal, same when restoring it restore XY first then Z.
it clean left extruder by moving from Xmin,Ymin to Xmin, Ymin +30 mm to clean left nozzle 4 times, this is ok for Davinci 2.0 but I do not know for Davinci 1.0
if 2nd extruder is defined it go to Xmax,Ymin to Xmax-20mn, Ymin to clean right nozzle 4 times
So be sure
#define X_MAX_LENGTH 235
#define X_MAX_LENGTH 199
#define Y_MAX_LENGTH 217
#define Z_MAX_LENGTH 202
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
are properly updated in eeprom

This code is supposed to be compatible Davinci 1.0 and 2.0 but I only tested 2.0 and simulate 1.0 on my 2.0, feel free to let me know if it working or need some changes

PS: I extensively tested keypad and I have noticed that even with original Davinci 1.0 repetier FW, screen sometimes freeze (when using or not) and do not respond, it is increased when plug/unplug USB, but it is back when again plug USB, anyone got same behaviour ?
EDIT: seems no more freeze since in comment #define WAITING_IDENTIFIER "wait" in configuration.h, need to dig in
This is great stuff, thank you! I was missing the power saving feature of the XYZ firmware (the clean up function is easily done in slic3r, but even better to have it built-in)

It'd be great though if you could put this on a github repo to allow easier tracking of changes (and to easily port them over to other people's repos).
Thanks but I have no idea how to do - is there an explaination of process somewhere ?
I also think would be good to have some test feedbacks first - to avoid several commit.
There are plenty of tutorials showing how to do it, it's pretty easy (eg: Learning your way around git however, if you are not familiar with it already, might take a bit longer.

Although actually the proper way to do it would be to start by forking the github repo where you originally downloaded the Repetier sources from. Then clone your forked repo to your computer and create a branch (call it davinci for instance). Then apply all your changes there (possibly just copy & paste what you already have) and commit & push. It'll then be easy for anyone else to diff and apply your patches over other Repetier branches (eg. I currently use Edouard's branch at
Update: it's been only a few days, but it seems to be working much better! I did have once a blank screen, but it was when turning the printer back on right after an emergency switch off to stop a bad print. Also I haven't had any more display garbling yet... crossing fingers.
Ho sorry - I misunderstood - you mean create my own github based on clone of the one I started (bgm one) to push all my changes

I though you refered to a special github like bgm one

sure, I can create one and share it, problem - give me a couple of days and I will share it
Quote:repetier FW, screen sometimes freeze (when using or not) and do not respond, it is increased when plug/unplug USB, but it is back when again plug USB, anyone got same behavior ?
The USB isuue is repetier related bug, here is the related discussion here
also [url=]ticket on github
Excellent!! thank you so much Smile

Forum Jump:

Users browsing this thread: 5 Guest(s)