nvram integer limitations



  • I've been storing epoch time stamps in nvram for some VIP events

    >>> import pycom; pycom.nvs_set('VIP', 1591319102); print(pycom.nvs_get('VIP'))
    1591319102
    

    But a typo has just shown me that this is only going to work till Jan 19 2038

    >>> import pycom; pycom.nvs_set('VIP', 2147483649); print(pycom.nvs_get('VIP'))
    -2147483647
    

    I'm such a sloppy programmer!



  • @kjm said in nvram integer limitations:

    1591319102); print(pycom.nvs_get('VIP'))

    Yes, NVRam only fits 32bit integers (signed). 2,147,483,647 is the maximum value you can fit in!
    Of course you can create your own workaround to use multiple keys.

    Gijs


Log in to reply
 

Pycom on Twitter