Avatar for AskHolme

AskHolme

Member since Sep 2022 • Last active Oct 2022
  • 1 conversations
  • 5 comments

Most recent activity

  • in Bangle.js
    Avatar for AskHolme

    Thanks. What constitues a cutting edge firmware?

    In terms of the other things i cut down my code to below and put in in timer.boot.js and now it "works" meaning that if i boot my bangle then the code will push the reboot down the line as long as i have not done anything but stay on the default clock.

    But if i boot the bangle, enter the launcher, go back to the default clock or boot the bangle and use the ~2 sec button push to reload the clock then the code will not work.
    Can it be true that some of these actions will kill boot code or maybe just clear any intervals?

    In timer.boot.js
    let wdKc;
    let wdBw;
    if (wdBw) {
      clearInterval(wdBw);
      wdBw=0;
    }
    wdKc=0;
    wdBw = setInterval(function () {
      
      if (BTN.read()) {
        if (wdKc < 3) {
    		E.kickWatchdog();
    		wdKc++;
    	}
      } else {
    	  wdKc = 0;
      }
    }, 4000);
    
  • in Bangle.js
    Avatar for AskHolme

    So i should have written this but i actually started trying with it as boot code, but that did not work at all.

    I can call setWatch in the boot file, but the watch function never gets activated.
    Initially i could not figure out if boot code could not write to console, so i tried running it with debug information going to a logfile instead, and you can see the code getting executed at boot time but the setWatch on BTN nevers runs.

    Can there be somewhere in the initializing code which clears all watches and which could run after my boot code?

    Also the reload of the default clock face in 2 secs, where is that controlled as i might want to tingle with that as well

  • in Bangle.js
    Avatar for AskHolme

    Hi

    So i tried this as i after thinking found it quite neat.

    As i wanted to kick the watchdog several times i tried something a little more elaborate - as you can see below.

    Key problem is that it does not work. Initially i set the interval to 3000 miliseconds and it would never get called. Now it is at 500 and it get's called and kicks the watchdog twice.
    After that none of the debug lines is printing more.
    So it seems to me that there is some code which after the button has been pressed between 1 and 1,5 seconds will effectively clear all intervals and times.

    I also tested directly with your code example and it has the same problem. The function set in setTimeout never gets called.

    I have nothing but a blank v15 firmware running on the watch (i have uploaded an additional app, but this happens on the standard clock without my app have ever been opened)

    let wdTm;
    let wdKc;
    let wdBw;
    if (wdBw) {
      clearWatch(wdBw);
      wdBw=0;
    }
    wdBw = setWatch(function(e) {
        if (wdTm) {
          clearInterval(wdTm);
          wdTm=0;
          console.log("WD clear");
          //print("WD kick cleared");
        }
      wdKc=0;
      console.log("button touched");
      if (e.state){
          console.log("setting interval");
        wdTm = setInterval(function () {
            console.log("in interval");
            if (BTN.read() && wdKc < 7) {
              E.kickWatchdog();
              console.log("watchdog kicked");
              wdKc++;
            } else {
              clearInterval(wdTm);
              console.log("WD clear by interval");
            }
        },500);
        console.log("interval set");
        }
    }, BTN, {edge:"both", debounce:50, repeat:true});
    
  • in Bangle.js
    Avatar for AskHolme

    Perfect this is what i was looking for

    For me it seems best to simply update the bootloader to have a higher timeout on the watchdog.

    I will also do some work on a custom clock that locksdown the app code side, but that seems easier for me. My real problem was getting my head around the bootloader/firmware code.

    Thanks for guiding me in the right direction

  • in Bangle.js
    Avatar for AskHolme

    Hi.

    I am trying to fiddle proof a bangle.Js 2 as i want to use it for various reminders for my 4 year old.

    As part of that i would really like to control for how long a interval one must hold the button before a reboot is triggered as the default one seems quite low for my situation.

    I have however some difficulties locating the actual code triggering the reboot.
    I can locate the firmware code in https://github.com/espruino/Espruino/blo­b/912aecb676c78e8fc0282775b46c7ad48c428a­30/targets/nrf5x_dfu/main.c where nrf_dfu_enter_check seems to be running directly after the reboot (controlling if we boot without loading code etc.)

    But what i need is really the trigger for the reboot. I have also looked in the bangle JS code but to no avail. There seems to be a E.Reboot function which trigges the reboot, but i fail to see anythign calling that.

    Can someone help on where the trigger code for a reboot is?

Actions