Hi everyone,
I use marlin for Ultimaker, I want to modify Marlin firmware to use ADC function, my idea is periodically detect a voltage level and cause a pause action to printer. Can you help to suggest some idea to deal with my problem.
Thank in advance!
Define an other extruder. Wait with M109. Maybe you need an alternative temperature conversion table.
@thachdovan Thanks for asking!
In temperature.cpp you will find an interrupt routine around line 1250 called ISR(TIMER0_COMPB_vect). Within that routine you will find a block starting switch (temp_state). This is where we do all of Marlin's ADC reading. It currently operates up to 4 temperature sensors and a filament-width sensor. You should be able to figure out from these examples how to read your own ADC device, adding your new device in same place. This is just where you get the reading from the device. If you want to use the reading to pause the printer, you'll need to add code to the loop() function to handle that part.
To pause SD printing: card.pauseSDPrint();
To pause non-SD printing: enqueuecommands_P(PSTR("M0")); (only works if LCD is attached)
There's no general way to pause host-based printing, except to go into a loop, and then there's no general way to un-pause from the host.
@thinkyhead Thank for your support !, I will try and response later.
Dear @thinkyhead ,
I want to make a ADC to detect two levels 0V and 3.3V, if value = 3.3V will pause the machine, the user need adjust rotate the button manually to resume (I use LCD with encoder button). Can you give me in detail about my case. The source so huge, I hope your help to make it easier.
Thank you!
@thachdovan I wish I could help more — I don't know much beyond what I described. There is the code I pointed out that reads sensors and stores the value, and there is code elsewhere that checks some of those values. I recommend using an editor where you can search many files at once, and follow the breadcrumbs to your solution. Searching on variable names, function names, etc., is the best way to follow the logic. Don't look at "all the code."
@thachdovan Windows is much more limited than Linux for this kind of stuff. But I pretty much have to be on a Windows machine. So... I use: http://www.wingrep.com/ to search for different text in all of the different files. That will let you isolate where a given variable or function is being used pretty easily.
Thank you guys!
I will try, this function is so vital with my system.
I use OS X, so if you need any tips on good tools for that system, I can recommend a few.
Thank you for your interest making Marlin better and reporting this issue but this topic has been open for a long period of time without any further development. Marlin has been under heavy development for the past couple of months and moving to it's last mile to finish the RC cycle and release Marlin v1.1.0. We suggest you to try out the latest RCBugfix branch and reopening this issue if required.