parallaxinc / Simple-Libraries

Contents of the SimpleIDE workspace folder and its Parallax Learn Simple Libraries subfolder.
http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder
21 stars 20 forks source link

Enhance ee_getStr/putStr #44

Closed MatzElectronics closed 7 years ago

MatzElectronics commented 8 years ago

Allow user to set the str length to zero - and have the function auto-detect the string length using the null terminator. The string, including the null terminator is written to and retrieved from EEPROM.

AndyLindsay commented 8 years ago

Thanks for the contribution. I did something similar when I first wrote them, using n = 0 for zero terminator. I also used a negative bytecount to set the maximum number of characters that would be allowed if the zero terminator was not reached. The negative values didn't seem like a good idea from the API standpoint, and I don't remember why I also decided to remove the zero terminator.

Looking at it now, I think it'll be worth a try, but it will need some extra work first.

Instead of a fixed value of 128, please add a function that configures a global variable that holds a byte count. The n=0 behavior would then go up to that byte count or c = 0, whichever comes first. I would recommend making the default 64 bytes since that's the size of the default serial buffer. (or is it 63... I don't remember; please check.) Please also update the documentation for the modified functions and the new one and make sure to test rigorously.

Here are some naming ideas.

int eeprom_zstrMaxCount; ee_zstrMax(int maxCount){}

zfi commented 7 years ago

@AndyLindsay Can you process this PR?

MatzElectronics commented 7 years ago

No - it's going to need a little more love than is currently there - it's taken a bit of a back seat to blockly. That being said, there will be a handful of Simple Libraries improvements to come once that dust settles.

Matthew Matz | STEM/Robotics Educator Parallax Inc. | Direct: 916-625-3019 | www.parallax.com | @M atzElectronics http://twitter.com/MatzElectronics

On Tue, Nov 29, 2016 at 11:44 PM, Jim Ewald notifications@github.com wrote:

@AndyLindsay https://github.com/AndyLindsay Can you process this PR?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/Simple-Libraries/pull/44#issuecomment-263805173, or mute the thread https://github.com/notifications/unsubscribe-auth/AS0quK2ugChGAyP-Ze6vceGj2TIyB-19ks5rDSlzgaJpZM4J6HnH .

MatzElectronics commented 7 years ago

I'm not opposed to someone closing it without pulling it - it can always be reviewed/reopened.

Matthew Matz | STEM/Robotics Educator Parallax Inc. | Direct: 916-625-3019 | www.parallax.com | @M atzElectronics http://twitter.com/MatzElectronics

On Tue, Nov 29, 2016 at 11:52 PM, Matt Matz mmatz@parallax.com wrote:

No - it's going to need a little more love than is currently there - it's taken a bit of a back seat to blockly. That being said, there will be a handful of Simple Libraries improvements to come once that dust settles.

Matthew Matz | STEM/Robotics Educator Parallax Inc. | Direct: 916-625-3019 | www.parallax.com | @M atzElectronics http://twitter.com/MatzElectronics

On Tue, Nov 29, 2016 at 11:44 PM, Jim Ewald notifications@github.com wrote:

@AndyLindsay https://github.com/AndyLindsay Can you process this PR?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/Simple-Libraries/pull/44#issuecomment-263805173, or mute the thread https://github.com/notifications/unsubscribe-auth/AS0quK2ugChGAyP-Ze6vceGj2TIyB-19ks5rDSlzgaJpZM4J6HnH .