Does RRF have maintenance counters/timers?
-
As jay has suggested you could use a global variable to track uptime , print time or whatever
This is untested but something like this. You may change the places it's called depending on if you want print time or uptimeIn config.g
global CumulativeTime = 0 M98 P"0:/macros/myUpTime.g" ; this could be in start.g if doing print time if global.CumulativeTime > 40000 ; or whatever echo "change filter"
In myUpTime.g (when created)
set global.CumulativeTime=0
In say stop.g you call a macro to update the time.
;updateTime.g M28 "0:/macros/myUpTime.g" set global.CumulativeTime = {global.CumulativeTime + state.UpTime} ; or add print time M29
This all may need other work (what if upTime rolls over etc), but you should get the idea
-
Thanks everybody for the suggestion. I will give it a try. A few of questions:
-
Can the current counter value be made visible in DWC?
-
Where the counter value is stored when the printer is off?
-
I couldn't figure in the code examples here where the counter value is read/stored on disk. Are global variables automatically persisted by default? If so, why CommulativeTime is set to zero in config.g (each time the printer starts).
-
-
@zapta said in Does RRF have maintenance counters/timers?:
Thanks everybody for the suggestion. I will give it a try. A few of questions:
- Can the current counter value be made visible in DWC?
Not by default, but with the btncmd plugin
- Where the counter value is stored when the printer is off?
A recent change allows macros to echo into a file ... so if you're okay with the occassional glitch from an emergency shutoff, that's gonna be something you will be able to do. I don't remember if it's already in 3.4b3.
- I couldn't figure in the code examples here where the counter value is read/stored on disk. Are global variables automatically persisted by default? If so, why CommulativeTime is set to zero in config.g (each time the printer starts).
No global variables aren't persisted by default. You'd need to find a way to write them to a file and read from that (see above for writing, I am not sure about reading).
-
@zapta said in Does RRF have maintenance counters/timers?:
Thanks everybody for the suggestion. I will give it a try. A few of questions:
- Can the current counter value be made visible in DWC?
Only in the object model viewer or BitCmd plugin
- Where the counter value is stored when the printer is off?
The counter is stored in the macro which is over written at the end of each session.
By adding the session time to the previous value, you store the running total.- I couldn't figure in the code examples here where the counter value is read/stored on disk. Are global variables automatically persisted by default? If so, why CommulativeTime is set to zero in config.g (each time the printer starts).
You have to recreate and assign a value to the global variables each time the printer starts.
It's easiest to just give it a value of zero.
Once the global has been created, you run the macro which does nothing more than update the value of the global variables.If you wanted to, you could overwrite the file in daemon.g
That would give you less chance of missing sessions if an estop was used etc, but it would dramatically increase disk writes which would shorten the SD card life. -
Thanks @owend. I still fail to understand.
Let's say that some file has the value of 10 hours and I turn on the printer and prints for 2 hours, what is the sequence of events that will end up with the file having the value of 12 hours? (e.g. where the reading is done?, where the addition is done?, where the writing back is done?)
-
@zapta said in Does RRF have maintenance counters/timers?:
what is the sequence of events that will end up with the file having the value of 12 hours?
With M28 you open the file that stores uptime, then you calculate the new cumulative uptime and close the file with M29.
@owend said in Does RRF have maintenance counters/timers?:
In say stop.g you call a macro to update the time.
;updateTime.g M28 "0:/macros/myUpTime.g" set global.CumulativeTime = {global.CumulativeTime + state.UpTime} ; or add print time M29
If it's just a single event you want to track (eg. a fixed 4 month intervall), you could as well write a message in your slicers startcode. It will repeat the same text everytime a print starts:" next filter change in january 2022"
-
@zapta
It's all done in the macro myUpTime.g
Whenever you create the new file using M28 it processes this line.set global.CumulativeTime = {global.CumulativeTime + state.UpTime}
What would actually appear in the file would be something like
set global.CumulativeTime = 547436446 ; in seconds
Because everything in the {} would be converted to a number.You're probably better off converting to hours as the number may exceed the maximum relatively quickly if left in seconds
So maybe
set global.CumulativeTime = {global.CumulativeTime + (state.UpTime/60/60)}; in hours
-
@owend, I get it now, thanks. We don't write data but we write a script that when executed later sets the in-memory variable to the desired value.
That's clever.
Going back to my original question, the answer is yes but not very user friendly (e.g. no UI support, having to managing the counter's persistence, etc).
I will set one such counter up and see how it works. Another alternative is to install something like this https://www.amazon.com/AC100-250V-Electromechanical-Hour-Meter-Counter/dp/B008MM0CV0
-
@zapta Something like this might be better https://www.amazon.co.uk/Jayron-Maintenance-Accumulated-Waterproof-Generator/dp/B08H1H9S9X/ref=sr_1_3?dchild=1&keywords=5V+DC+hour+meter&qid=1630489831&sr=8-3
It's claimed to be suitable for 5 to 60 volts so one could connect it to a spare io pin and use M42 in one's start gcode (or elsewhere) to keep a count of print time, rather than "on time". Or one could use M571 to keep track of hours spent extruding.
-
Thanks @deckingman, it definitely looks nicer.
I thought about using the heatsink fan signal ('nozzle is hot') to enable counting but will it show the count when the printer is idle?
Also, finding one that doesn't need a battery would be nice.
-
@owend i Wrote Following File:
Config.g
; Variables global ZAxisPos = 0 M98 P"0:/macros/VariableBuffer.g" ; Update Axis Value from Z
that's the main macro: Possibly called every 5 Seconds from daemon.g
;WritePosition.g set global.ZAxisPos = {move.axes[2].userPosition} M28 "0:/macros/VariableBuffer.g" G92 Z{global.ZAxisPos} M29
in the VariableBuffer.g it's:
G92 Z{global.ZAxisPos}
You Mentioned everything in the {} will be converted into Numbers but not in my Case?
what have i done wrong? -
@neueklasse said in Does RRF have maintenance counters/timers?:
G92 Z{global.ZAxisPos}
Perhaps it helps to make some math? e.g.
G92 Z{global.ZAxisPos + 0}
-
I find it bizarre that in 2021 RRF still doesn't have basic statistically information available in a log file for uptime, print time, filament usage....
I read that when filament types were first provided that filament usage would be logged "in the future" seems the future is still waiting.I know this sounds like a rant and you know what maybe it is..... I'd be happy with any of this to end up in a log file and i'll bet the people pleading for counters would be happy with the caveat that on a power interruption/loss that x minutes of data would not be available.
-
@cosmowave Sorry it doesn't work either...
M28 Writes the exact code into my VariableBuffer, but no the Value!.. -
@dc42 Thank you for the Post in the Thread "M28 + object models"
finally i Managed it to get it working how it should.
echo >"0:/macros/VariableBuffer.g" "G92 Z"^{global.ZAxisPos}^" "
M28/M29 doesn't work (at least in my Case..)
with the echo command i finally have a Variable buffer that's persistent!
-
Hi All,
Along a similar vein I'd like to track how many times the y axis stepper has rotated, as a proxy for y axis drive belt life. I think I can use this method but I don't know if there is a related variable I could interrogate.Given it's a polar machine perhaps cumulative bed rotation might do it.
My printer tends to break belts, but insidiously such that the belt reinforcement breaks but the rubber holds and stretches causing print artefacts.
I'd like to track usage to define a preventative maintenance schedule.
I'm also fitting a heavier duty blet during this next round of upgrades
Any constructive thoughts would be much appreciated.
Cheers
Barry M -
@cncmodeller Maybe you can sum up the absolute value of the current y-position. You'd have to poll it every 0.n seconds to get a semi-accurate value, but for wear-prognose it'll do.
-
@neueklasse said in Does RRF have maintenance counters/timers?:
@dc42 Thank you for the Post in the Thread "M28 + object models"
finally i Managed it to get it working how it should.
echo >"0:/macros/VariableBuffer.g" "G92 Z"^{global.ZAxisPos}^" "
M28/M29 doesn't work (at least in my Case..)
with the echo command i finally have a Variable buffer that's persistent!
Just wondering if there's a way not to overwrite the file, but append new values at the file-end?
//edit It's simple! Using echo>><filename> <expression>, <expression>, ... does the trick.
-
@o_lampe said in Does RRF have maintenance counters/timers?:
absolute value of the current y-position
That might work, I'll have to think it over...
-