Skip to content

Commit

Permalink
add deprecation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 3, 2024
1 parent 1d1707d commit 743af5d
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions libs/bluetooth/jswrap_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions libs/hexbadge/jswrap_hexbadge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
1 change: 1 addition & 0 deletions libs/network/esp8266/jswrap_esp8266_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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."],
Expand Down
1 change: 1 addition & 0 deletions libs/pixljs/jswrap_pixljs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
1 change: 1 addition & 0 deletions libs/puckjs/jswrap_puck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
8 changes: 7 additions & 1 deletion scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) { ... })'
Expand Down Expand Up @@ -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"]+" "
Expand Down
2 changes: 2 additions & 0 deletions src/jswrap_number.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
Expand All @@ -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;"
Expand Down
1 change: 1 addition & 0 deletions src/jswrap_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [
Expand Down
2 changes: 2 additions & 0 deletions src/jswrap_spi_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [
Expand Down Expand Up @@ -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" : [
Expand Down

0 comments on commit 743af5d

Please sign in to comment.