8 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

2 comments

  1. IsildursBane
    (edited )
    Link
    Now that I have my screen working on my DIY MP3 player, it is time to start working on getting the clickwheel functional. It is worth mentioning, that I am using this Github project by Guy Dupont...

    Now that I have my screen working on my DIY MP3 player, it is time to start working on getting the clickwheel functional. It is worth mentioning, that I am using this Github project by Guy Dupont as a basis.

    The clickwheel I am using is a modern Adafruit 5001, which is a rotary encoder and five buttons. It seems like skimming over Dupont's code, that he got the Apple clickwheel to communicate very similar to I2C. I am going to try and figure out if I can avoid that and wire the switches and encoders directly to the GPIO pins and make it communicate that way. I am unfamiliar with Raspberry Pi GPIO pins or rotary encoders, so I will tackle getting the switches working first. I checked with my multimeter, and the switches are as I expected to be normally open switches, using a shared ground and their respective pins. So my plan is to see if I can get the Raspberry Pi to detect each of the five switches. Once that is achieved, I will understand GPIO better to tackle the rotary encoders. If I am unable to get that working, I can buy an I2C board for my clickwheel and set that up.

    Once the clickwheel is working, it should just require that I read and modify Dupont's clickwheel.c code to read inputs from my clickwheel and then setting up the rest of the software stack. Luckily, Dupont's YouTube video showcasing the project got popular so Dupont has documented his project pretty well so that others can use his as a guide.

    Edit: I got all five buttons working on the clickwheel today, it was easier than I expected. Now I just need to get the rotary encoders working and then I can start putting the software stack together.

    Edit 2: Rotary encoders are relatively straightforward, but also the code to write it working with GPIO pins is not as abundant on the internet. Odds are I will have to write my own code to get it working, probably in Python. The only problem is Python is not my preferred programming language, and I am on some meds short term that makes it a bit harder to program/research for longer stretches of time.

    Edit 3: I found a github repo that had basic code that works for rotary encoders for the Raspberry Pi. After some slight modifications, I got it working with my encoder. Now all that is left is to put all the individual components of the python code I have written/modified into one piece of code that can replace Dupont's clickwheel.c code.

    2 votes
  2. xk3
    (edited )
    Link
    Yesterday I added some tests to my rank_dataframe convenience function which ties a few pandas functions together to sort dataframes by multiple columns. Previously, I was rescaling the ranks:...

    Yesterday I added some tests to my rank_dataframe convenience function which ties a few pandas functions together to sort dataframes by multiple columns.

    Previously, I was rescaling the ranks:

    scaled_ranks = (ranks - 1) / (len(ranks.columns) - 1)
    

    It has been a couple years and I'm not sure why wrote that. But it was causing the function to behave in unexpected ways when using descending order on all columns. So I removed that lol

    I also added a pd.qcut by default so small differences between values are not over-represented. Overall, I'm pretty happy with how it works now