Avatar for rigrig

rigrig

Member since Apr 2020 • Last active Nov 2021
  • 2 conversations
  • 36 comments

Most recent activity

  • in Bangle.js
    Avatar for rigrig

    Another data point for fiddling with the firmware:
    >analogRead(D3)=0.29321289062
    (It won't go over 68% charged)

  • in JavaScript
    Avatar for rigrig

    If it does look worse, wouldn't it be better to leave it out?
    Because otherwise code that tries to do the "right" thing actually makes things worse:

    if (g.drawLineAA) g.drawLineAA(...)
    else g.drawLine(...) // for devices without AntiAliasing
    

    And if you end up writing this

    if (device_is_B2) g.drawLine(...) // AntiAliasing looks bad on 3-bit screen
    else g.drawLineAA(...)
    

    You wonder why the Bangle.js 2 even implements AA functions.

    I guess you could just make it so *AA functions don't actually AntiAlias, so more code will run on both devices seemlessly, but that just seems Wrong...

  • in General
    Avatar for rigrig

    As it is a watch, how about having Bangle emit time events?

    Bangle.on('hour', function(time) { 
      // time is a Date object
      // fires exactly once per hour, with minutes/seconds/milliseconds = 0
    })
    Bangle.on('minute', function(time) { 
      // time is a Date object
      // fires exactly once per minute, with seconds/milliseconds = 0
    })
    Bangle.on('second', function(time) { 
      // time is a Date object
      // fires exactly once per second, with milliseconds = 0
    })
    

    At least for buzzing every hour or redrawing clocks this should be sufficient to get rid of manually setting timeouts/intervals.

    No idea if this would have a serious impact on performance/battery life though (especially for the V1, where clocks tend to clear their timeouts when the LCD is off)

  • in Bangle.js
    Avatar for rigrig

    the issue with a 'core' library is stuff always gets added to it

    Good point, Settings it is then.

    enforce settings.json so just require('Settings').get('app', 'option.to.get', 'default') might be better

    You're right, I think I mostly avoided it because I couldn't think of a nice way to ask for global settings from settings.json (passing in an empty first argument seems error-prone). But we can pass in Bangle (the object) and check for that. (unless that would lead to some issue like huge RAM usage I didn't think of?)

    • 5 comments
    • 361 views
  • in Bangle.js
    Avatar for rigrig

    I was thinking about adding simple Settings library, just something like
    require('Settings').get('app.settings.js­on', 'option.to.get', 'default'); and
    require('Settings').set('app.settings.js­on', 'option.to.set', 'value');

    Probably wouldn't be much work to implement, but we could get rid of (almost?) all of the defaults-handling boilerplate in apps.

    • Does this seem like a good idea, or would it add too much overhead for apps? (I think it would be ok, as they are already loading+parsing a settings file anyway)
    • Having a separate library just for two functions feels a bit cluttery, maybe a "Core/Standard/Basic/Bikeshed" library with getSetting/setSetting would be better? (I can't really think of similar functions right now, but going through all apps to change it later would be a shame.)
  • in Bangle.js
    Avatar for rigrig

    I'd be happy to take a look at it, most of the work will just be moving some code around anyway.

  • in Bangle.js
    Avatar for rigrig

    flashing a zip via the Web IDE? How exactly did you do this

    I downloaded a ZIP to my PC, then uploaded it into the browser. I got it to work using F12 by setting a breakpoint in the stepDownload function and manually setting data.binary_url = '' in the console. (it was undefined)

    I imagine the Layout error you hit was because of the bootloader.

    Yeah, it was late and I was tired, so it was probably just me forgetting to upload the bootloader.

    messing with Storage while out-of-memory probably somehow managed to erase all storage, no idea if it's reproducible

    from what you describe it may be even this case https://github.com/espruino/Espruino/iss­ues/2075
    otherwise there is issue https://github.com/espruino/Espruino/iss­ues/2009

    I doubt it was the watchdog, as the watch didn't reboot by itself.
    Basically the watch was showing a "Memory" error, I tried long-pressing BTN3 which gave some error I forgot, and holding BTN1+2 got me stuck at the boot screen.
    As for the memory error: I was testing an app which logs all incoming Gadgetbridge messages, and strongly suspect that caused it: it reads the full log into memory every time a new message arrives, and I got a few large ones that day.

  • in Bangle.js
    Avatar for rigrig

    Today was also kind of a long/busy day, but I figured I'd post now while I remember it best:

    1. I managed to soft-brick my Bangle v1. I strongly suspect it has to to with my "great" idea to log all GB messages, which probably resulted in a combination of out-of-memory errors and Storage calls happening at almost the same time.
    2. When I got home, the web IDE didn't list any files left in storage, so I figured I'd reset my watch
    3. "Install default apps" didn't work, because https://banglejs.com/apps/defaultapps_ba­nglejs.json doesn't exist
    4. Manually reinstalled apps, including my beloved barclock
    5. Ran into some errors caused by Layout (a bit fuzzy what went wrong exactly... probably missing polyfills from me forgetting to install the bootloader.)
    6. Tried to update to cutting edge firmware by downloading the zip, ran into an error because of

      function stepDownload(data) {
      if (window && window.location &&
          window.location.protocol=="https:" &&
          data.binary_url.substr(0,5)=="http:") // Uncaught TypeError: Cannot read properties of undefined (reading 'substr')
        data.binary_url = "https:"+data.binary_url.substr(5);
      data.flashFn(data);
      }
      
    7. managed to flash the cutting edge firmware, still errors

    8. uploading the latest bootloader fixed it (I think I probably forgot to upload it, and just tried to load() the clock from the web IDE, getting those errors because it was missing polyfills)

    tl;dr:

    • messing with Storage while out-of-memory probably somehow managed to erase all storage, no idea if it's reproducible
    • "Install default apps" is broken
    • Flashing a local zip file is broken
  • in Bangle.js
    Avatar for rigrig

    just remove qmOptions/etc from settings and instead store it in the Quiet mode app?

    That would probably clean up things a bit.
    So the idea is:

    Current situation:

    • global quiet setting: apps check this so they know whether to buzz
    • global qmOptions setting: overrides options like brightness during quiet mode
    • qmsched app: changes quiet setting at scheduled times, shows a widget

    After moving things to qmsched:

    • keep global quiet setting: apps still check this. No longer needs it's own submenu.
    • qmsched app changes quiet setting at scheduled times, shows the widget
    • qmsched app also handles overriding options like brightness
Actions