diff --git a/libs/bluetooth/jswrap_bluetooth.c b/libs/bluetooth/jswrap_bluetooth.c index 8165c3d96..a455c3801 100644 --- a/libs/bluetooth/jswrap_bluetooth.c +++ b/libs/bluetooth/jswrap_bluetooth.c @@ -2365,6 +2365,7 @@ void jswrap_ble_setTxPower(JsVarInt pwr) { "type" : "staticmethod", "class" : "NRF", "name" : "setLowPowerConnection", + "deprecated" : true, "generate" : "jswrap_ble_setLowPowerConnection", "params" : [ ["lowPower","bool","Whether the connection is low power or not"] diff --git a/libs/hexbadge/jswrap_hexbadge.c b/libs/hexbadge/jswrap_hexbadge.c index b4d008274..388627e75 100644 --- a/libs/hexbadge/jswrap_hexbadge.c +++ b/libs/hexbadge/jswrap_hexbadge.c @@ -192,6 +192,7 @@ int jswrap_badge_capSense(int corner) { "type" : "staticmethod", "class" : "Badge", "name" : "getBatteryPercentage", + "deprecated" : true, "generate" : "jswrap_badge_getBatteryPercentage", "return" : ["int", "A percentage between 0 and 100" ] } diff --git a/libs/network/esp8266/jswrap_esp8266_network.c b/libs/network/esp8266/jswrap_esp8266_network.c index 83451e132..4b1e47493 100644 --- a/libs/network/esp8266/jswrap_esp8266_network.c +++ b/libs/network/esp8266/jswrap_esp8266_network.c @@ -1270,6 +1270,7 @@ void jswrap_ESP8266_wifi_soft_init() { "class" : "ESP8266", "ifdef" : "ESP8266", "name" : "ping", + "deprecated" : true, "generate" : "jswrap_wifi_ping", "params" : [ ["ipAddr", "JsVar", "A string representation of an IP address."], diff --git a/libs/pixljs/jswrap_pixljs.c b/libs/pixljs/jswrap_pixljs.c index cd794be7f..8f8bdeff2 100644 --- a/libs/pixljs/jswrap_pixljs.c +++ b/libs/pixljs/jswrap_pixljs.c @@ -47,6 +47,7 @@ Class containing utility functions for "type" : "staticmethod", "class" : "Pixl", "name" : "getBatteryPercentage", + "deprecated" : true, "generate" : "jswrap_espruino_getBattery", "return" : ["int", "A percentage between 0 and 100" ] } diff --git a/libs/puckjs/jswrap_puck.c b/libs/puckjs/jswrap_puck.c index acbcc0085..b285d0422 100644 --- a/libs/puckjs/jswrap_puck.c +++ b/libs/puckjs/jswrap_puck.c @@ -1349,6 +1349,7 @@ JsVarFloat jswrap_puck_light() { "class" : "Puck", "ifdef" : "PUCKJS", "name" : "getBatteryPercentage", + "deprecated" : true, "generate" : "jswrap_espruino_getBattery", "return" : ["int", "A percentage between 0 and 100" ] } diff --git a/scripts/common.py b/scripts/common.py index 23739b911..da2d5a80d 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -71,7 +71,9 @@ def f(*popenargs, **kwargs): # // EV_CUSTOM = Called whenever an event of type EV_CUSTOM is received (jswOnCustomEvent(event)) # // EV_xxx = Something to be called with a character in an IRQ when it is received (eg. EV_SERIAL1) (jswOnCharEvent) # // powerusage = fn(JsVar*) called with an object, and should insert fields for deviec names and estimated power usage in uA (jswGetPowerUsage) -# "class" : "Double", "name" : "doubleToIntBits", +# "class" : "Double", +# "name" : "doubleToIntBits", +# "deprecated" : "2v24", // mark that this may be removed in the future (version=when it was deprecated). Adds a comment to description # "needs_parentName":true, // optional - if for a method, this makes the first 2 args parent+parentName (not just parent) # "generate_full|generate|wrap" : "*(JsVarInt*)&x", // if generate=false, it'll only be used for docs # "generate_js" : "full/file/path.js", // you can supply a JS file instead of 'generate' above. Should be of the form '(function(args) { ... })' @@ -206,11 +208,15 @@ def get_jsondata(is_for_document, parseArgs = True, boardObject = False): try: jsondata = json.loads(jsonstring) if len(description): jsondata["description"] = description; + else: jsondata["description"] = "" jsondata["filename"] = jswrap if jswrap[-2:]==".c": jsondata["include"] = jswrap[:-2]+".h" jsondata["githublink"] = "https://github.com/espruino/Espruino/blob/"+githash+"/"+jswrap+"#L"+str(linenumber) + if "deprecated" in jsondata and not "deprecated" in jsondata["description"].lower(): + jsondata["description"] = "**DEPRECATED** - this will be removed in subsequent versions of Espruino\n\n" + jsondata["description"]; + dropped_prefix = "Dropped " if "name" in jsondata: dropped_prefix += jsondata["name"]+" " elif "class" in jsondata: dropped_prefix += jsondata["class"]+" " diff --git a/src/jswrap_number.c b/src/jswrap_number.c index 0a03b638e..106116b8d 100644 --- a/src/jswrap_number.c +++ b/src/jswrap_number.c @@ -145,6 +145,7 @@ JsVar *jswrap_number_toFixed(JsVar *parent, int decimals) { "type" : "variable", "name" : "HIGH", "ifndef" : "SAVE_ON_FLASH", + "deprecated" : true, "generate_full" : "1", "return" : ["int32","Logic 1 for Arduino compatibility - this is the same as just typing `1`"], "typescript" : "declare const HIGH: true;" @@ -154,6 +155,7 @@ JsVar *jswrap_number_toFixed(JsVar *parent, int decimals) { "type" : "variable", "name" : "LOW", "ifndef" : "SAVE_ON_FLASH", + "deprecated" : true, "generate_full" : "0", "return" : ["int32","Logic 0 for Arduino compatibility - this is the same as just typing `0`"], "typescript" : "declare const LOW: false;" diff --git a/src/jswrap_serial.c b/src/jswrap_serial.c index 788f5b405..da3690e00 100644 --- a/src/jswrap_serial.c +++ b/src/jswrap_serial.c @@ -104,6 +104,7 @@ Espruino boards) "type" : "staticmethod", "class" : "Serial", "name" : "find", + "deprecated" : true, "ifndef" : "SAVE_ON_FLASH", "generate_full" : "jshGetDeviceObjectFor(JSH_USART1, JSH_USARTMAX, pin)", "params" : [ diff --git a/src/jswrap_spi_i2c.c b/src/jswrap_spi_i2c.c index 5d21538de..cc627f939 100644 --- a/src/jswrap_spi_i2c.c +++ b/src/jswrap_spi_i2c.c @@ -73,6 +73,7 @@ JsVar *jswrap_spi_constructor() { "type" : "staticmethod", "class" : "SPI", "name" : "find", + "deprecated" : true, "ifndef" : "SAVE_ON_FLASH", "generate_full" : "jshGetDeviceObjectFor(JSH_SPI1, JSH_SPIMAX, pin)", "params" : [ @@ -533,6 +534,7 @@ JsVar *jswrap_i2c_constructor() { "type" : "staticmethod", "class" : "I2C", "name" : "find", + "deprecated" : true, "ifndef" : "SAVE_ON_FLASH", "generate_full" : "jshGetDeviceObjectFor(JSH_I2C1, JSH_I2CMAX, pin)", "params" : [