• I can confirm that commit 5be8869ae36b7d9fe955e1b1071b9f8a58a0­38cf produces the problem:

    let firstFix = true;
    let mesureStartTime;
    let latestLogTime;
    
    function calcTimeDifference(fix) {
      if (!fix.time) {
        return;
      }
    
      const currentDateTime = new Date();
      const delta = currentDateTime - fix.time;
      if (firstFix || delta < 0) {
        // Set the time to the first time received, or if the time is behind the GPS time 
        // because we have a forward drift
        console.log(`${fix.time.toISOString()} Start measuring`);
    
        setTime((new Date() - delta) / 1000);
        firstFix = false;
        mesureStartTime = latestLogTime = new Date();
      } else if (!latestLogTime || (currentDateTime - latestLogTime) > 60000) {
        const measureSeconds = (currentDateTime - mesureStartTime) / 1000;
        console.log(`${currentDateTime.toISOString()} difference ${(delta / 1000).toFixed(3)} second/s within ${measureSeconds.toFixed(3)} second/s`);
        latestLogTime = currentDateTime;
      }
    }
    console.log(process.env.VERSION);
    Bangle.on("GPS", calcTimeDifference);
    Bangle.setGPSPower(1);
    
    2v21.123
    2024-06-23T18:08:40.000Z Start measuring
    2024-06-23T18:09:40.012Z difference 0.013 second/s within 60.009 second/s
    2024-06-23T18:10:40.020Z difference 0.020 second/s within 120.016 second/s
    2024-06-23T18:11:40.025Z difference 0.025 second/s within 180.022 second/s
    2024-06-23T18:12:40.033Z difference 0.034 second/s within 240.030 second/s
    2024-06-23T18:13:41.026Z difference 0.026 second/s within 301.023 second/s
    2024-06-23T18:14:42.019Z difference 0.019 second/s within 362.016 second/s
    2024-06-23T18:15:42.023Z difference 0.024 second/s within 422.020 second/s
    
    2v21.124
    2024-06-23T18:49:06.063Z Start measuring
    2024-06-23T18:50:06.106Z difference 0.044 second/s within 60.039 second/s
    2024-06-23T18:51:06.146Z difference 0.084 second/s within 120.079 second/s
    2024-06-23T18:52:06.182Z difference 0.119 second/s within 180.116 second/s
    2024-06-23T18:53:06.216Z difference 0.153 second/s within 240.149 second/s
    2024-06-23T18:54:06.250Z difference 0.187 second/s within 300.183 second/s
    2024-06-23T18:55:06.286Z difference 0.224 second/s within 360.219 second/s
    2024-06-23T18:56:06.328Z difference 0.266 second/s within 420.262 second/s
    
  • https://github.com/espruino/Espruino/com­mit/5be8869ae36b7d9fe955e1b1071b9f8a58a0­38cf

    v21.124
    This is the culprit, but I have no idea why, it doesn't seem like it should be the culprit.

    Good find. The first change looks harmless if the SYSCLK_FREQ is divisible by 1000 (which it maybe is - 64000000 for nrf52?). but the second is now multiplication by small floating point number with low precision so maybe that may be the cause.

About

Avatar for d3nd3-o0 @d3nd3-o0 started