Yesterday was challenge day! It was long, it was hard, and… What am I talking about?! :p
Anyway, I started out ok, being able to receive a request and resend one within 2 seconds pretty quickly. But then I got stuck on something very stupid, for hours… Turned out I couldn’t do it two times in a row, the second one wouldn’t work. So, not knowing if it would be important for the next steps or not, I decided to fix the issue.
The problem was with the http_request buffer that got overwritten and contained more info that I wanted at the beginning of the second try. So when I sent it to the server, it wasn’t happy. After some time (meaning 1h) trying to fix my way of doing things, it didn’t work any better, so when Sam said that those who hadn’t yet managed to send two requests in 2 seconds had to implement it using mailboxes, I thought to myself: ok, you’ve been stuck on that for hours, maybe that’s the solution. So I started from scratch and implemented a mailbox. It was probably a cleaner way than what I was doing before, but as it turns out, when it was done and worked, I still had my buffer problem…
The solution was very, very stupid, as it often is: I finally asked Sam how I could fix my buffer problems, he told me that I shouldn’t have one because the buffer should get overwritten at each step with the string I want (ending with a null character) and the rest of it shouldn’t matter because it shouldn’t get sent to the server since it was after the null character. And there you have it: the problem was with a line of code I had copied from an lwip example earlier this week that sends the request to the server, using sizeof(http_request)… instead of strlen(http_request)… I think I don’t have to tell you how angry I was at myself at this point, because changing one word in my code made it work perfectly, instantly, and would have made my previous way of doing things work as well! So to sum up I lost about 4h on 6 f**king characters! \o/
Then I went on to the next steps and got to the LCD screen, but the challenge was over before I could make it work and I’ve since then improved it but I can’t test it (we don’t have the screens any longer).
So this challenge was… interesting! And very, very frustrating! But I should have found my mistake way earlier, or simply asked Sam or Alexis why it wasn’t working properly, I guess my stubbornness got the better of me! I wish I could have made it to the last steps, the maze seemed like a fun thing to implement.
Anyway, now it’s all about HeRos for a month and I think we’re ready to handle it using ChibiOS! 😉
Until next time!
Sorry for the long post, here’s a potato: