Post AmWSWYoAp5a151h3Am by ddr@pony.social
 (DIR) More posts by ddr@pony.social
 (DIR) Post #AmWSLQuhpoorPTRWYi by ddr@pony.social
       2024-09-30T07:49:58Z
       
       0 likes, 0 repeats
       
       why is my code causing a bootloop when i read a boolean
       
 (DIR) Post #AmWSLRlse7M04OJzRQ by Dan_Ramos@noauthority.social
       2024-09-30T07:51:59Z
       
       0 likes, 0 repeats
       
       @ddr Is this true or false?
       
 (DIR) Post #AmWSWYoAp5a151h3Am by ddr@pony.social
       2024-09-30T07:53:56Z
       
       0 likes, 0 repeats
       
       @Dan_Ramos uh, I have been unable to ascertain that, my esp32 reboots when I try to read it. It's a member variable of the class my function is in. It should be fine.I'm pretty sure I'm getting trolled by an optimising compiler here, because I tried eliminating all the other access and it still crashes...
       
 (DIR) Post #AmWSrp3JcepBXeukl6 by Dan_Ramos@noauthority.social
       2024-09-30T07:57:46Z
       
       0 likes, 0 repeats
       
       @ddr Ahhh... ESP32 told me everything I needed to know about why it was a bootloop in the first place.  It seems like anything done on a microcontroller that hard-crashes will bootloop.  As to why and what to look for.. if there's no debugger, you might need to start including some serial output and a bunch of DEBUG printing to trace it.  Might be a problem ahead or even behind the code that causes it.  Classic programming stuff.
       
 (DIR) Post #AmXKlT8rZFBHNIvdTc by ddr@pony.social
       2024-09-30T18:01:44Z
       
       0 likes, 0 repeats
       
       @Dan_Ramos Yeah, it must be somewhere else. I tried deleting the code that was setting the variable being read, so it was just a constant read of false (do nothing), but no cigar. If I comment the check out, it's fine too.I'm going to have another shot at it today, print-trace more stuff. I'm getting some registers printed out, so it's trying to tell me what's going on, but I really have no idea what to do with those. I haven't been able to work out how to map them back to the source code I'm looking at. :/
       
 (DIR) Post #AmXyuOiXNqnkQPQYb2 by Dan_Ramos@noauthority.social
       2024-10-01T01:31:35Z
       
       0 likes, 0 repeats
       
       @ddr I don't do much microcontroller coding but... is there a way to do a step-trace (ie. print all variables, run command, print all variables, run next command, print all variables, etc. ...sometimes only stepping into the next command after pressing space.. one step at a time.).
       
 (DIR) Post #AmY4vghiatuEDz2hVo by ddr@pony.social
       2024-09-30T21:25:30Z
       
       0 likes, 0 repeats
       
       I have figured it out. :woemknife:
       
 (DIR) Post #AmY4vhYXQW9mrnksqG by ddr@pony.social
       2024-09-30T21:45:48Z
       
       0 likes, 0 repeats
       
       Usually, if I have a member constant I want to have configurable in my constructor, I have it by the same name in the constructor parameters. In this case, ModePattern* backingMode was passed in, and then saved for later use in the constructor list via backingMode(backingMode). This pattern has worked fine for about two years (:neocat_sob:) at this point.Today, it stopped working because I had a lambda function which captured by reference, [&](){...}-like. I had copied out the pattern sampling function, backingMode->sample(samplePoint, Layer::Primary) from another function in my class. Copy-paste-done, works perfectly, moving on. Except.I'd copied it into my constructor. The way precedence works, backingMode is looked up first in function args, then in class members. So when I moved the line of code up to the constructor, inside the lambda function, it neatly captured a reference to the constructor parameter instead of the class member function which was being used previously. And this worked fine, until I actually went and looked up a member variable in the lambda which was run after the function returned. A few seconds later, the memory was overwritten with some value that pointed into the zero-page, and I get the error.It could have been hours. We got lucky this time. :blobfoxcatterrified:Anyway, I just learned how addr2line works in Linux, so that's useful going forward. I'm... new to this yet. Another entry in the #ravelights development ongoing saga :blobfoxfacepalm:
       
 (DIR) Post #AmY4viPiEogvWidLiy by ddr@pony.social
       2024-09-30T21:53:52Z
       
       0 likes, 0 repeats
       
       It's not so much that I love Rust as I hate C++ with a living passion.
       
 (DIR) Post #AmY4vjDLGIOG0dqz56 by jordan@sometimes.social
       2024-09-30T22:03:30Z
       
       0 likes, 0 repeats
       
       @ddr C++ is the Australian wildlife of programming languages, it hates you back
       
 (DIR) Post #AmY4vjyqPgO6Ny4v7g by Dan_Ramos@noauthority.social
       2024-10-01T02:38:59Z
       
       0 likes, 0 repeats
       
       @jordan @ddr Fukkin truth.
       
 (DIR) Post #AmY51savIadWq6ohEW by Dan_Ramos@noauthority.social
       2024-10-01T02:40:10Z
       
       0 likes, 0 repeats
       
       @ddr The old saying is, it's almost always a missing bracket somewhere.  ;)
       
 (DIR) Post #AmYADAjAijLm2BsYgC by ddr@pony.social
       2024-10-01T03:38:08Z
       
       0 likes, 0 repeats
       
       @Dan_Ramos There is a way, but I don't think I have the hardware here for it.