24
galena
2y

Another project with legacy code got just dusted off at work. Shits fucked beyond recognition! We got:
- Rando variable names that mean nothing
- Timers running with a cycle time of 2.5ms if you start them with the multiplier 1.
- An Interrupt routine thats 300 lines long.
- Another interrupt thats starting an ADC conversion and waiting for it to complete before returning.
- For loops that start with one and subtract one from the iterator in the loop
- Every value that would normally be expressed as a regular number is written down in Hex. Eg: if(val==0x05)
- State machine built without writing down which state is which. Its just a number. (In hex obviously!)
- All running on a Microcontroller you cant debug on.
- Using a compiler no one has ever heard of before.
- Weird ass Port manipulations
- 15 different .hex and .elf files with no clue whats in them.
- No version control
- We tried explaining the code to a monkey and it hanged itself.

Comments
  • 2
    With its tail?
  • 0
    Not gonna lie. My interrupt routines were long (but not 300 lines long), but usually written in assembly. They certainly didn't wait on anything.
  • 5
    Nightmare fuel
  • 0
    There are dongles for some microcontrollers you can debug with. I have one for PIC chips. Hopefully there is something out there for yours.
  • 3
    That last line made me laugh while spewing out my drink.
  • 2
    @electrineer Nah, we have a lot of cabels around the office. It just ripped some, made a noose and just started hanging around!
  • 1
    @galena next rant: PM feels threatened by monkey noose.
  • 1
    Fuck, at that point you might be better off writing something from scratch. It never ceases to surprise me how good something can come out if it's completely written anew.
  • 1
    Test each part and write it from scratch with the inputs and expected outputs?
  • 1
    Was this project made by an intern as a proof of concept and PM was like, "that's now a 10M$ market, ship it!"?
Add Comment