Dukweeno / Duckuino

Simple DuckyScript to Arduino C converter.
https://dukweeno.github.io/Duckuino/
MIT License
355 stars 117 forks source link

Ram optimization #28

Closed Flambello closed 7 years ago

Flambello commented 7 years ago

hello instead of Keyboard.print("hello world"); can you make it do Keyboard.print(F("hello world)); so that the print will not get stored in the ram and instead go in the flash memory making longer line scripts possible

the foto is of a verry long script without the (F()) it uses around 8k ram with the (F()) it uses only 220

untitled

Plazmaz commented 7 years ago

This is something I used in the original version of Duckuino, but it seems to have gotten lost in translation. However, writing everything to flash may not be the best way of doing things, otherwise, it would probably be the default, I'll need to look into this more

Flambello commented 7 years ago

Oooh ok thnx for the responce

lowlevl commented 7 years ago

@Plazmaz You could add it in your post-processor :D Or we could add a checkbox to let the user decide ^^

Flambello commented 7 years ago

Uuuu that whould be nice!

Plazmaz commented 7 years ago

I think that sounds good. I like the idea of being able to disable it.

Flambello commented 7 years ago

Haha best software on github!

Plazmaz commented 7 years ago

@Flambello Thanks! If you think it's good now, get ready for v2.

lowlevl commented 7 years ago

:MindBlown: ^^ @Plazmaz @Flambello

Flambello commented 7 years ago

No problem im glad my suggestion helps!!!

bytedeez commented 7 years ago

@Flambello @Plazmaz I have about 5 scripts i need to use this for. I am still learning .js and jquery at the moment Where in the code could i make this change? I searched through the code but nothing stuck out to a novice like myself to make this change without some expert advice, I did go through one of my sketches but it took forever going line by line, i would really love to automate it for my very long sketches. My smallest one takes up 377% of available ram. After adding the (f()) attribute to only half of my sketch i was able to upload it to my board. Thanks in advance!

Plazmaz commented 7 years ago

@bytedeez consider it done.

lowlevl commented 7 years ago

Since v2.0-pre is here and this disappeared, I'm reopening this, @Plazmaz should release the Ram Optimization update some days :D

Plazmaz commented 7 years ago

@Nurrl nope, this is something different. This issue is asking for the use of Fstrings instead of normal strings. Should be an easy fix 😄

lowlevl commented 7 years ago

Yep ^^ But it Optimizes ram x)