updating my git in 2 min
this was the issue. it should have been
def on_settings_save(self, data):
Git updated... aldo i was working on another thing (ignore triggers) and its not going well
all your log.info
should probably be self._logger.info
never mind. I see how you're defining it higher up. still in most cases you would use the above approach and not have to define the logger yourself.
add:
Delay input field .... tested and working
Ignor triggers .... WIP badly... but WIP (NOT WORKING)
todo:
Add a ENABLE/DISABLE button so the plugin only works whenever the user whats to do timelapses... like octolapse... you have to enable it every job
i changed to "save" and it works it i change from 21 to 19
but if i change it back to 21 i get an error saying it's already in use
2024-03-02 19:31:57,386 - octoprint.server.api.settings - ERROR - Could not save settings for plugin Sla Timelapse (1.0.0)
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/server/api/settings.py", line 1202, in _saveSettings
plugin.on_settings_save(data["plugins"][plugin_id])
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/util/__init__.py", line 1686, in wrapper
return f(*args, **kwargs)
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_slatimelapse/__init__.py", line 77, in on_settings_save
self._setup_gpio()
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_slatimelapse/__init__.py", line 36, in _setup_gpio
GPIO.add_event_detect(gpio_pin, GPIO.BOTH, callback=self._ldr_changed, bouncetime=300)
RuntimeError: Conflicting edge detection already enabled for this GPIO channel
git updated
in your if condition of the on_settings_save callback you need to remove the previous setup. this is done with
GPIO.remove_event_detect(old_gpio);
I've done this with TPLinkSmartPlug plugin using the SimpleApiPlugin mixin, but in your case I think it would be easy enough to bind a navbar button/toggle to set and call the internal OctoPrint settings and save.
agreed ,,, nav button sounds great
it would look something like this ?
def on_settings_save(self, data):
old_gpio = self._settings.get_int(["gpio_pin"]) # Move this line here
super().on_settings_save(data)
new_gpio = self._settings.get_int(["gpio_pin"]) # Get the new GPIO pin after settings save
if old_gpio != new_gpio:
GPIO.remove_event_detect(old_gpio) # Remove event detection for old pin
self._setup_gpio() # Set up GPIO for the new pin
self.ignore_triggers = self._settings.get_int(["ignore_triggers"]) # Update ignore triggers
self.trigger_count = 0 # Reset trigger count when settings are changed
Git updated
- Ignore triggers working and logging
- GPIO change working without errors
todo
- Add Enable/Disable button to Nav bar
- find a way to complite all photos into a propper timelapse
- display to the user a timelapse file to download
I almost have this working but have run into a snag with the bindings. Still working on it.
oh man.... ty
kept scratching my head why it wasn't working and it's because you didn't have the AssetPlugin mixin added. I think I have it all tweaked up and working now. You can view the changes here.
WOWOWOWOWOW
that was alot of changes mate... gona check them and let you know..
ty
yeah, they weren't all necessary, but was also cleaning up some other stuff while I was in there.
i got the navbar button there and now i am working on the why it's not working... probably something i haven't indented... back in a flash
It's odd
i copyed all the changes over, the togger button does show in the navbar but when i press it nothing happens....
and when i hover it as a link href i get #
and acting like a Anchor in HTML that is sending me to the bottom of the page...
probably i can't even do a copy/past correctly
git updated
you missed some.
this is completely wrong. should be HelloWorldViewModel
changed it but still nothing
i click on it and nothing happens ... not even a warning nor error nothing