-->
Page 1 of 1

Add a flash READNUM command for reading numeric variables

PostPosted: Sat May 14, 2016 4:23 pm
by Electroguard
READ and WRITE to flash memory is great for string variables, but can be much more problematic for numeric variables.

If you WRITE a numeric variable called Duration with a value of 5000, you can't then READ it back into Duration without Duration now becoming a text variable which will most likely cause operational errors if manipulated or compared.

READ reads the flash text variable directly into the specified variable name, so you can't do a val() of the text to convert it during the READ. The only way of NOT converting your previous numeric variable into a text variable is to NOT READ back into it, and do something like...
READ FlashVarName temp
let Duration = val(temp)

It works, but it's not nice when you have several saved numbers to READ back, and it's something that might be improved upon when time permits.

It could easily be catered for by an additional READNUM command that internally did a val(string) of the required read numeric variable.

It could also benefit from some accompanying housekeeping commands that would allow listing, renaming, and deleting of flash variables - because currently the only way is to reformat and reflash the ESP.

Re: Add a flash READNUM command for reading numeric variable

PostPosted: Mon May 30, 2016 12:36 pm
by JYB
Another way would be to allow
DIM Duration AS INTEGER