diff --git a/index.html b/index.html index b0ce939..d0d13bf 100644 --- a/index.html +++ b/index.html @@ -312,6 +312,36 @@ +
+ +
+ Configure Display (optional) +
+ +
+
+
Rotation
+ + + + +
+
+ +
+
Setting display rotation requires firmware v1.80+
+
+ +
+ @@ -1708,6 +1738,32 @@ "- Bluetooth pin will shown on your RNode screen and on this page.", ].join("\n")); + }, + async setDisplayRotation(rotation) { + + // ask for rnode + const rnode = await this.askForRNode(); + if(!rnode){ + return; + } + + // check if device has been provisioned + const rom = await rnode.getRomAsObject(); + const details = rom.parse(); + if(!details || !details.is_provisioned){ + alert("Eeprom is not provisioned. You must do this first!"); + await rnode.close(); + return; + } + + // configure + console.log("setting display rotation"); + await rnode.setDisplayRotation(rotation); + console.log("setting display rotation: done"); + + // done + await rnode.close(); + }, async readAsBinaryString(blob) { return new Promise((resolve, reject) => { diff --git a/js/rnode.js b/js/rnode.js index 9e20269..1f545fc 100644 --- a/js/rnode.js +++ b/js/rnode.js @@ -79,6 +79,7 @@ class RNode { ROM_UNLOCK_BYTE = 0xF8; CMD_HASHES = 0x60; CMD_FW_UPD = 0x61; + CMD_DISP_ROT = 0x67; CMD_BT_CTRL = 0x46; CMD_BT_PIN = 0x62; @@ -750,6 +751,13 @@ class RNode { return new ROM(rom); } + async setDisplayRotation(rotation) { + await this.sendKissCommand([ + this.CMD_DISP_ROT, + rotation & 0xFF, + ]); + } + } class ROM {