Test if running on real device?

Posted on
  • Is it possible to test whether an app is running in the IDE or on a real device (Bangle 2)? For example, E.getBattery() always returns zero in the IDE so it's hard to check if a low charge warning is needed. Thanks and sorry if I'm missing something obvious!

  • maybe there is better version but check output of process.env

    >process.env
    ={
      VERSION: "2v16.1",
      GIT_COMMIT: "1a18b5384",
      BOARD: "EMSCRIPTEN2",
      RAM: 0, FLASH: 8388608, SPIFLASH: 8388608, HWVERSION: 2, STORAGE: 8388608,
      SERIAL: "00000000-addeadde-addeadde",
      CONSOLE: "USB",
      MODULES: "Flash,Storage,hea" ... "tensorflow,locale",
      EXPTR: 155840 }
    > `
    

    so you may test process.env.BOARD or the SERIAL

  • Thanks a lot, @fanoush, just what I wanted.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Test if running on real device?

Posted by Avatar for BillV @BillV

Actions