Hi, I have a question regarding the sketch size. Namely I introduced only few PTL and out of sudden I don't have any more space and verify fails with too large error. Since I am a beginner I am not sure what is calculating the size so I removed most of the ifdef Developer checks , Printlines and comments in order to lower the size and I somehow managed it. Then I started playing with Nybble.ino and adding and altering and doing printlines mostly to figure it out how it is working and then again I run into same error - > no space. so I copy pasted version where I had space and then surprise -> no space....
I currently have 588 lines and almost no space. in this version I do not have a single printline entered by myself and no my functions.. pure petoi and then again no space.
Can you help me please and let me know what is exactly influencing the size and contributing to the error. I am really puzzled
If you want to temporarily gain some program memory space, you can set a compile directive to not use the gyros (see below). Of course doing so effectively puts the Nybble into turbo mode since the servos get more cpu cycles. If you want to use this trick a lot, you would need to throttle back the servos by e.g.:
[1] using more steps as is done in the behavior() function with speedRatio or
[2] using the same number of steps but with a pause after each (new code would be needed) or
[3] reduce the servo voltage (hardware fix).
Of these, I am planning to use approach [1].
Update: 2020-07-05
Since the behavior() function only works for poses and the need above is to throttle back the servos in gaits, approach [1] will currently not work for this purpose.
I think the simplest approach at present is to turn on the compile directive "#define SKIP 1" in Nybble.ino. See @Rongzhong Li's comment here. Of course, this doesn't provide fine speed control nor can you change the speed in real time (though the latter could be handled with some code changes, e.g. approach [2] above). BTW, changing SKIP to higher integer values will further slow the gait speed which can be handy for study of each frame in a gait!
Code Snip:
#ifdef USE_GYROS // set our DMP Ready flag so the main loop() function knows it's okay to use it PTLF("DMP ready!"); dmpReady = true; //TS dmpReady = false will disable the checkBodyMotion() function so the gyros will not be used and speed increases to turbo. Program memory consumption drops to 89% in my case. #endif
Use latest arduimo IDE ~
I am curious about this very limited program storage space issue I keep seeing referred to in various posts, docs etc. Please excuse this question as I am a total newbie at this stuff and having somehow managed to actually get the Nybble assembled and basically working am, like yourself, wanting to get into the programming side. So my question is why is there so little storage capacity? I believe that there are Arduino boards available with signifcantly more storage space - maybe they are too big, require too much power? I am also curious about how much capability is possible with adding a Pi like you mentioned including more space for program code.
Is there any possibility to use other environment for coding and debugging such as VS Code or similar. Can you please explain what needs to be done there in order to import your board? I would like to have sort of step by step debugging possibilit. Not sure if this is possible with arduino or nybble board in general
Upload this code and try to understand how the code blocks are enabled or disabled.
#define PRE_PROCESSOR void setup() { Serial.begin(57600); // put your setup code here, to run once: #ifdef PRE_PROCESSOR Serial.println("the pre_processor block is active"); #else Serial.println("if you comment out the first line of this sketch"); #endif } void loop() { // put your main code here, to run repeatedly: }
Hi I deleted all ifdef Developer statements as well (additional Printlines, switches...) So this should not be the problem.Additionally developer is commented out just in case.
Can you tell me what is influencing this size. Is total number of lines and file size or loading active parts of the code in the memory? Or something else that I am not aware of?
Edit: Also can this be resolved by using RaspPi together with Petoi board?
#ifdef Developer
will activate some debugging println that's unnecessary. You may comment the #define Developer out and add only the println you need in the program, rather than activate them all at once.