Ok, i thought i found a solution to this issue when the slow scanning cycles of the rfid board became a problem for order of events but now i am stuck. For clarity, ill refer to my setup for blade detect as crystal detect.
The problem:
The rfid tag gets scanned before the crystal detect switch is pressed. Which means waiting until the next rfid scan cycle.
My solution and new problem:
I wired the rfid vcc to my crystal detect pin at blade7pin thinking that, only when the switch is pressed, the rfid reader will turn on and then scan the crystal. This worked well with crystal detect disabled (for testing). When i re-enabled it, the serial monitor shows it detects a crystal without being pressed. I believe this is due to the switch off state being at 0.8V (low?) and 4V in the on state (high). For blade detect to work as originally programmed, the off state should be floating, correct? Is there a way for me to modify the blade detect function to only consider it detected when pulled high?
Picking this up again, as I have a Kestis Elite with removable chassis and removable speaker pod, and I’d like to have a Blade Detect system for each one.
So @NoSloppy, with your code above, what happens in the Blades Array? Do you just have one NO_BLADE array and one blade-in array? In which case adding any blade takes you to the blade in array and plays the bladein sound effect, even if other blades are already fitted?
I may try a different method to solving this issue.
I’ll return the RFID VCC to battery positive and leave the crystal detect pin using the expected floating/high logic on blade7pin. I may move the RFID gnd pin to a free blade negative like bladePowerPin1 and see if I can use blade detect to switch the RFID board on/off on the software side instead.
Becase of problems with blade detect, the blade detect pin varies between “pullup” and “pulldown”, but it’s never set to just “high”, and it is never just floating.
It’s possible to change this, check this code for how:
I would wire VCC to battery positive and wire VDD to one of the LED pins and then use something like a blink style to turn the rfid on/off once every second or so. Then it’s just a matter of having a timeout of a few seconds to detect when the crystal is rmoved.
After trying a few different ways to go about it, I ended up sticking with rfid vcc wired to my crystal detect switch (switched to battery positive).
I disabled blade detect and set up the blade7pin in the prop file to detect and react to switch release only (high to low). This fixed an issue i encountered where based on the debouncing of the switch press, the reading of the button press lagged behind the RFID reader’s first scan, forcing me to wait until the next tag reading cycle (~10s).
So eliminating any software functions related to the switch press and focusing solely on the switch release, i get immediate crystal tag detection/RFID preset switch, and when removed i get immediate detection of the switch release to trigger a preset change to preset 0 (“calibrate”, no crystal preset). So it is looking good for functionality of the crystal in/out of the chamber. Very happy with that! I’ll have to add in a couple fun glitchy sounds as part of the calibrate font announcement since i no longer get the blade out sound.
I have also disabled previous/next preset function for the aux button when off so I’ll have to rely on crystals alone to change the preset!