Display time until next filament change and other time-until-whatever info in OctoPrint
3
stars
1
forks
source link
I could change this from `info` to `debug`, yeah: https://github.com/eyal0/OctoPrint-TimeToFilament/blob/master/octoprint_TimeToFilament/__init__.py#L144 #37
The order of the regex search will vary because we only search for the ones that we need to search for. If our cached M600 result is still in the future then we don't need to search for it. But if it's in the past then we need a new one. Likewise for the other ones. We don't loop over each regex and then loop over each line. We loop over each line and then apply the regex to the line. This is because jumping around in the file is slower than jumping around between regexs.
I could change this from
info
todebug
, yeah: https://github.com/eyal0/OctoPrint-TimeToFilament/blob/master/octoprint_TimeToFilament/__init__.py#L144The order of the regex search will vary because we only search for the ones that we need to search for. If our cached M600 result is still in the future then we don't need to search for it. But if it's in the past then we need a new one. Likewise for the other ones. We don't loop over each regex and then loop over each line. We loop over each line and then apply the regex to the line. This is because jumping around in the file is slower than jumping around between regexs.
To maintain which regexs need to be processed and which not, we use a set. https://github.com/eyal0/OctoPrint-TimeToFilament/blob/master/octoprint_TimeToFilament/__init__.py#L108 The set is not ordered and the order might change each time (this is a security feature). But it shouldn't affect correctness of the code. If you see that it is, I want to know about it!
Originally posted by @eyal0 in https://github.com/eyal0/OctoPrint-TimeToFilament/issues/31#issuecomment-1231900546