Open axle-h opened 9 years ago
Thanks for that - looks great. I will add the enhancements based on your work!
@axle-h does your fork work when using the GPIO adapter ? I installed it hoping it would solve the issues i'm having with my SNES controllers, but i don't know what values i should put in the configuration file, since the pins of the SNES controllers are not directly connected to the Pi GPIOs.
Never mind, i found my answer for revision 2 of the adapter :
It's working but i see you have removed the option to handle different behaviours on 1, 3 or 5 presses on the button. Is there a way to get this option back ? Sorry to ask this question here, but you didn't open the "issues" tab on your Github fork.
Hi, Yeah probably not right place to be talking about a different branch here until/if it gets pulled. Issues can only be created on the original repository unfortunately. Is my email address not visible? I don't know about the adapter - I built my own. Most of the fun of using the Pi is to find your own way anyway!
I took the button press polling thing out as it was a bit over complicated, was difficult to setup from a config file and I didn't need it. It should be relatively easy to implement though. Check out button.c. It's a simple state machine. You just need to add some more states and decide when to switch to them. Maybe add a counter in the button struct and "do stuff" when it hits a particular threshold - I think that's how Florian implemented it. It might be difficult however to add this to the config. Hence why it's not in my branch. Might look at it. Be an excuse to have another dabble with this. Unless you fancy a go?
I'm writing here instead of e-mailing because this may be of some interest to someone using your fork :) I understand your code but i'm not a C dev, so for now i'll keep it like this. Maybe i will try to patch it some day. For the configuration of the button, you don't have to make it fully configurable with a variable amount of programmable key presses. Maybe you could just have something like this :
Buttons {
Button 1 {
Enabled = true
# Tap the button to press this keyboard key
SinglePressKey = "R"
#SinglePressCommand =
# Double tap the button to press this keyboard key
DoublePressKey = "ESC"
#DoublePressCommand =
# Hold the button for 3 seconds to execute this command
LongPressCommand = "shutdown -t 3 -h now"
#LongPressKey =
Gpio = 5
}
# Frequency to poll buttons in Hz
PollFrequency = 2
}
What do you think ?
Check out my branch. https://github.com/axle-h/SNESDev-RPi
I haven't made a pull request because I've changed so much. Instead, here's where I think you can improve this.
Performance:
Accuracy:
Some general daemon stuff:
Improvements