Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Apr 2021

Most recent activity

  • in Bangle.js
    Avatar for Gordon

    Hi - sorry to hear this - I'm surprised the seal had actually broken though. Do you think it had got crimped in the case?

    I'll drop you an email now and I'll get a new one posted to you.

  • in Bangle.js
    Avatar for Gordon

    Ok, well it seems there's code already to go back to the main menu when BTN2 is pressed, so all you need to do is change BTN2 to BTN3 in this code:

      setWatch(()=>{
        Bangle.removeListener('accel', accelHandler);
        showMenu();
      }, BTN2);
    

    In terms of saving the measurement, I guess you want everything to start when you choose Start from the menu? So in that case it's the startRecord function.

    Right now, after recording is started, accelHandler is called for each measurement, so you just need to change that do something like this:

    function accelHandler(accel) {
        var t = getTime()-start;
        // get max value from all axes
        var maxValue = Math.max(Math.abs(accel.x), Math.abs(accel.y), Math.abs(accel.z));
        // write time and max value
        f.write([
          t*1000,
          maxValue].join(",")+"\n");
        /* we only want to save one value and return? If so remove
        our acceleration listener and go back to the menu... */
        Bangle.removeListener('accel', accelHandler);
        showMenu();
      }
    
  • in JavaScript
    Avatar for Gordon

    That's great - thanks! I just created an issue for UART.js to keep track of this: https://github.com/espruino/EspruinoWebT­ools/issues/6

    I'm not sure when I'll get time, but hopefully I'll get those issues fixed.

  • in JavaScript
    Avatar for Gordon

    I guess a work around is to trigger a connect by sending an empty UART.write('\n')

    Yes, that's what I'd do... Sometimes it's good practice to send a "\x03" (ctrl-c) anyway as if there was any command left on the REPL's input line that will clear it out

  • in JavaScript
    Avatar for Gordon

    As I understand it, UART.write/eval will create a connection (internally) and will then use that - so if you're writing to just a single device then that's all you need. You're prompted on the first call and after that it 'just works'.

    It feels not optimal to have to duplicate that part of the code:

    Yes, you're right. The write/eval there should really be some common functionality in the connection object, or at the very least should take a connection as an argument so could be used on multiple connections. Are you interested in making that change, or should I look at it?

    Is there a way to do both these things at once? For example adding a custom connection.on("data", cb) on the same connection used by UART.write() and UART.eval().

    I believe after you're connected, you can just do UART.getConnection().on('data', ...)?

  • in Bangle.js
    Avatar for Gordon

    I'm not sure I understand what you want? So when BTN2 is pressed you just want to write a single value (whichever is bigger out of X, Y or Z?).

    Do you want BTN3 to exit the app completely and go back to the clock, or just to go back to the app's main menu?

  • in General
    Avatar for Gordon

    Hi,

    Q1: Is there a specific switch that must be set in order to produce the .lst listing file?

    For STM32 it 'just happens' - for nRF52 you need to do ... make lst. Code listings when building natively (eg to run on your PC) aren't supported - but chances are you're not wanting to trawl through x86-64 assembly code so I doubt this is a big deal?

    Q2: Explanation please on: 'now you can "run ./espruino" '

    Yes, ./command is the Unix syntax for 'run the command in the current directory'.

    Chances are you did BOARD=... RELEASE=1 make which built Espruino for that board, not to run on your local PC - so there was no 'espruino' executable.

    To run it locally, all you need is:

    make clean
    make
    ./espruino
    

    If that fails, chances are the make step produced some errors?

    Have been successful in building using VSCode and flashing using esptool.py as a separate step. ... I may live to regret doing it this way

    Yes, probably! I'm not sure what VSCode does, but on Windows 10 it is very easy: https://github.com/espruino/Espruino/blo­b/master/README_Building.md#under-window­s

    You just install WSL (which you may already have now): https://docs.microsoft.com/en-gb/windows­/wsl/install-win10

    Then follow the instructions for Linux: https://github.com/espruino/Espruino/blo­b/master/README_Building.md#under-linux-­recommended

    And it should work out of the box

    Q3: As the GitHub source is all .c/.cpp is there a way to start and run my functions and wrappers from within VSCode to make use of breakpoints and the debugger there, without having to flash and call from the WebIDE? Is there a demo or test functions available?

    So you want to compile and run Espruino on your PC and debug the functions there? That should be totally fine.

    On linux (or WSL), you'd be doing something like:

    make clean
    DEBUG=1 make
    gdb ./espruino
    

    I don't use VSCode so I don't know what you need to do to debug there, but I imagine if you googled something like "debug Makefile projects in VSCode" it might work ok

    • 5 comments
    • 305 views
  • in Bangle.js
    Avatar for Gordon

    Right now there's nothing to report. Gadgetbridge's whole ethos is not to use an internet connection, so there's no way of this being added as an 'all in one' thing.

    However I've been talking to a company that's using Espruino in their watches and hopefully we'll be able to benefit from their work on an app for Android/iOS - and hopefully extend it to finally provide some easy internet connectivity options too.

  • in News
    Avatar for Gordon

    Thanks! The MTU increase is entirely @fanoush's work though, so he deserves all the credit for that!

Actions