I think there is a bit of confusion between “blade detect” and “blade ID” here.
Blade ID uses extra resistors on the data pin to identify the blade. However, it is not able to detect if the blade changes. Blade Detect uses a separate line to detect when a blade is connected, but it does not use any resistors, so it only has two states “blade in” and “NO_BLADE”.
So, this leads to some options. Let’s start with the ones that don’t require any ProffieOS modifications:
-
Just use Blade ID. This means putting one resistor in the hilt and one in the blade. Something in the 10-50k range would work for each. And you would use the \frac{1}{1/R1 + 1/R2} to calculate the total resistance. PROS: no extra wires, no coding CONS: does not detect when hilt or blade is removed, you have to switch power on and off and of for it to re-detect what is connected.
-
Use blade detect for the chassis and blade ID for the blade. This means sacrificing some pins on the 6-pad connector for blade detect. We don’t need an ID resistor in the hilt, just in the blade. PROS: no coding, sound effect when chasis is inserted/removed, CONS: no effect when blade is inserted/removed
-
Use blade detect for both blade and chassis. Normally, blade detect is done by separating one of the ground pins on the hilt-side pogo pin pcb so that it is not connected to the rest of the ground pins. Once the blade is inserted though, it becomes connected. However, because the ground pins are controlled by FETs, the blade detect pin is pulled low when the blade is on and pulled high when the blade is off. (And not pulled anywhere when the blade is not connected.) The positive pins on the other hand don’t have this problem, they are always connected to battery power. So if instead of separating a negative pin for blade detect, we separate a positive pin instead, we end up with a pin that is either floating or pulled high. Since this pin is now never pulled low, we can use that. We would need to connect a 10k resistor between the blade detect pin and GND (a real GND, not one controlled by FETs). Now we just need to create some special blade detect code that treats HIGH, LOW and FLOATING separately. PROS: blade insertion sounds all around CONS: coding, extra wires and pads needed
-
A slight modification of (3) would be to use two separate blade detect pins. One that goes to the blade and one that goes to the chassis. The one in the chassis would need to connect to a positive pad, or to a real GND in order to work properly. Again, some code modifications would need to be done. This might be the simplest way to do it this way if possible. PROS: proper insert/removal sounds CONS: coding, extra wires
Now I can help with the coding here. Probably (4) is the easiest as I can just re-use some of the code we already have and add defines for a chassis detect pin.
of what?