code: function (data, callback) {
      if (txCharacteristic === undefined) return;
  
      if (data.length>NORDIC_TX_MAX_LENGTH) {
        console.error("BT> TX length >"+NORDIC_TX_MAX_LENGTH);
        return callback();
      }
      if (txInProgress) {
        console.error("BT> already sending!");
        return callback();
      }
  
      console.log("BT> send "+JSON.stringify(data));
      txInProgress = true;
      try {
        txCharacteristic.write(Espruino.Core.Utils.stringToBuffer(data), false, function() {
          txInProgress = false;
          return callback();
        });
      } catch (e) {
        console.log("BT> SEND ERROR " + e);
        closeSerial();
      }
    }
docs: Throttled serial write