PyScore’s startup script

*** PRELIMINARY ***

Description

The startup script runs every time the product starts. Its role is namely to override the default behaviour of the device, should it be requested. If this script is left empty, the product starts normally.

Example

import springcore
import logging

from springcore import *

logging.info("\nRunning PyScore over SpringCore " + springcore.version())

if !springcore.isGenuine():
    logging.error("This device is not genuine!")
    
if !springcore.isReader():
	raise Exception("Script invocation error")
# Reader scripts are not runned when the device is not configured for Smart Reader operation!
# This is only a sanity check

# Retrieve a persistent variable
startCount = 1 + springcore.load("START", 0)
logging.info("Startup count: " + startCount)
# Save the new value, in the NVM
springcore.save("START", startCount)

# Play a short beep
springcore.play(240)