Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data not staying resident to watch

Is anyone seeing this issue? In the last week I have had customers reach out saying they enter data into my app settings, it transfers to the watch but after some time the data disappears on the watch.  Almost as if something is deleting the resident file.  

 

I am  am left wondering  what has changed? My app hasn't.  I am not able to duplicate it in tests but I am running Android, so could it be an iOS 13/Fitbit OS 4.0 issue?

Best Answer
0 Votes
3 REPLIES 3

This is probably a dumb question, but are you explicitly saving the data to a file on the watch? If not, it will disappear when the app/clockface is closed.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Not a dumb question, but yes all the data is bidding written to a file on the watch which the app then pulls the data from. It's been working fine for at least six eight months. but then last week I get seven or eight people that say the enter data into their app it goes to the watch and then disappears. Almost as if there's a communication issue writing to the file or the file is being deleted.

Best Answer
0 Votes

I had a similar issue. My problem was the file was being written before it was read occasionally.

 

The problem became more prevalent as the app got bigger. I found it by logging file actions to the console and they showed the write was triggering before the initial read was completed.

 

I addressed this by setting a first pass variable to true at the beginning of the module,

 

import {debug, lg} from "../../common/common.js"
import * as fs from "fs";
import {locale} from "user-settings";
import {gettext} from "i18n"

 

var fPass=true

 

then set it to false as part of the file read

 

fPass=false

const listDir = fs.listDirSync(".")

var dirIter
while((dirIter = listDir.next()) && !dirIter.done) {
  let fileName = dirIter.value
  switch (fileName){
  case "kpay.status.cbor":
  case "kps": break
  case "p.txt":
    e.update(fs.readFileSync(fileName, "cbor"),false)
    break
  default:
  }
}

 

Then I check fPass before allowing the first write

 

,update:function(vals,saveSet=true){
  if (Object.keys(vals).length!==0 && !fPass){
    for (let val in vals){
      if (typeof p[val] == typeof vals[val]) p[val] = vals[val]
      else lg("pVar not Found",val,function(T){console.log(T)})
      if (saveSet){
        clearTimeout( pSvTO )
        pSvTO = setTimeout(function(){fs.writeFileSync("p.txt", p, "cbor")}, 2000)
      }
    }
  }
}

 

The timeout function is to facilitate consolidating multiple data updates into a single file transaction.

 

Regards,

Reign

 

This is from the watchface at https://gallery.fitbit.com/details/bda6f514-3946-49ba-a4ed-75e8470ab034

ILuvChronoAnim.gif

Best Answer
0 Votes