fix int/float values
This commit is contained in:
parent
1828e6399a
commit
0f1b116593
@ -685,7 +685,7 @@
|
||||
"serial.writeValue": "Write a name:value pair as a line to the serial port.",
|
||||
"serial.writeValue|param|name": "name of the value stream, eg: x",
|
||||
"serial.writeValue|param|value": "to write",
|
||||
"storage": "Provides access to persistent storage functionality.\n\r\nProvides access to persistent storage functionality.",
|
||||
"storage": "Provides access to persistent storage functionality.\n\nProvides access to persistent storage functionality.",
|
||||
"storage.getNumber": "Reads a key value pair from the non volatile storage as a number",
|
||||
"storage.getNumber|param|key": "the key for accesing the value",
|
||||
"storage.getString": "Reads a key value pair from the non volatile storage as a string",
|
||||
|
@ -49,7 +49,7 @@ namespace storage {
|
||||
//% blockId=storage_put_number
|
||||
//% group="Put"
|
||||
export function putNumber(key: StorageSlots, value: number) : void {
|
||||
let managedValue = (value * 1000) | 0;
|
||||
let managedValue = Math.floor(value * 1000);
|
||||
putValueInt(storagesInt[key], managedValue);
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
|
||||
namespace pxsim.storage {
|
||||
|
||||
function putValue(key: string, value: string) : void {
|
||||
export function putValue(key: string, value: string) : void {
|
||||
sessionStorage.setItem('simulatorValue_'+key, value);
|
||||
}
|
||||
|
||||
function putValueInt(key: string, value: number) : void {
|
||||
export function putValueInt(key: string, value: number) : void {
|
||||
sessionStorage.setItem('simulatorValue_'+key, value+"");
|
||||
}
|
||||
|
||||
|
||||
export function getValue(key: string) : string {
|
||||
if(sessionStorage.getItem('simulatorValue_'+key)) {
|
||||
return sessionStorage.getItem('simulatorValue_'+key);
|
||||
|
Loading…
Reference in New Issue
Block a user