Avatar for Gordon

Gordon

Member since Sep 2013 • Last active May 2021

Most recent activity

  • in Interfacing
    Avatar for Gordon

    Also worth noting that you were asking about JSON5 in another post. You can do manufacturerData:E.toJS(data) and EspruinoHub is smart enough to parse the more compact JSON5

  • in JavaScript
    Avatar for Gordon

    Ok, great - I just filed an issue at https://github.com/espruino/Espruino/iss­ues/2005 so hopefully we can get that fixed at some point.

    There's no specific documentation on the calibration phase as far as I remember, but basically:

    The real time clock only runs at 32kHz, which means if you're trying to measure pulse widths, you'll bump into problems with accuracy pretty quickly... So we use the 'System Tick' timer which runs at the same speed as the processor - but we want the two to keep in sync (neither is 100% accurate).

    There's some code which keeps track of how many System Ticks there are for each tick of the RTC, so that when you ask for the time it can look at the system time and work back to a high res value, but in RTC time. It just takes a few seconds to figure out exactly what that should be...

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Ok, so I'd say based on https://www.espruino.com/Pico#-a-name-po­wer-a-power-and-the-fet-b0-jumper your best bet is just to connect your external micro USB connector straight to the Vout pin on the Pico (the one highlighted in the picture, just to be sure).

    That should be totally fine to use even when the Pico is also connected to your PC via its own USB

  • in Interfacing
    Avatar for Gordon

    Great! Yeah, I think we were trying to cut down on the 'noise' from MQTT, but that one is a bit frustrating.

    I've just updated the docs...

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    actually, i 've sold a micro usb female deported plug on pin Vout and GND

    Do you have a picture? You can actually sand off the solder resist and solder a mini USB to the rear of the board if you want to.

    i need to access to usb pad for code update purpose

    Do you need this at the same time? Because it would potentially be really bad news to attach power to the USB power input and then plug it into your PC as well.

    i've tried on the + - battery pad, but curent is not enough on the output a read only 2.7V on the Vout pin...

    I believe the battery pad is the same as Vin, so if you're not able to get enough power through that then I think it might be better to just attach the USB power directly to the VOut pin

  • in JavaScript
    Avatar for Gordon

    Try E.toJS? This is basically JSON5, but I think things like pin names and functions can also be dumped.

    For parsing, you can just use eval - but obviously you need to be able to trust the data since there are security issues there (any JS code in the input will get executed!).

  • in JavaScript
    Avatar for Gordon

    Ok, if you pull now it's fixed!

  • in JavaScript
    Avatar for Gordon

    Ahh, ok - so custom fonts were tweaked a while back to allow the use of antialiased fonts - so rather than just 1BPP, 2 or 4. You can see what happens if you change the BPP in http://www.espruino.com/Font+Converter

    I'll see about getting a fix in now

  • in Bangle.js
    Avatar for Gordon

    Ok, no problem! The issue is you're not erasing behind the text, so it's drawing the numbers over each other. You currently have:

    function updateScreen() {
        g.reset();
        g.clearRect(0,h/2 - 20,w-20,h/2 + 20);
        g.setFontVector(40).setFontAlign(0,0);
        g.drawString(x1.toFixed(2),w/3,h/3.2);
        g.drawString(y1.toFixed(2),w/3,h/1.4);
      }
    

    so try something like:

    function updateScreen() {
        g.reset();
        g.setFontVector(40).setFontAlign(0,0);
        g.clearRect(0,h/3.2 - 20,w-20,h/3.2 + 20);
        g.drawString(x1.toFixed(2),w/3,h/3.2);
        g.clearRect(0,h/1.4 - 20,w-20,h/1.4 + 20);
        g.drawString(y1.toFixed(2),w/3,h/1.4);
      }
    
  • in JavaScript
    Avatar for Gordon

    Hi - which board are you running the code on?

    The STM32-based boards run a high res timer which they adjust to match the RTC, to allow for high resolution timing. I guess it's possible that if you adjust time time during the initial calibration phase, it's possible it might confuse it.

    When the timers fire rapidly, does it go back to normal after some time? And what about if you call TimeController.readCurrentTime maybe 10 seconds after boot? Does it work then?

Actions