Freezing during Download

edited August 2017 in iOS




p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px}

I am using the MetaTrackr device paired with an iPhone 6s.  When I start to download logged data, the device freezes and memory usage skyrockets.  


Any ideas what might be going on?

Comments

  • Which app are you using to log the data?
  • Its a modified version of the MetaWearApiTest app, but the function to start and stop logging are the same.  See code below: 







    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; min-height: 13.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #93c96a}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4dbf56}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4dbf56; min-height: 13.0px}
    span.s1 {font-variant-ligatures: no-common-ligatures; color: #c2349b}
    span.s2 {font-variant-ligatures: no-common-ligatures}
    span.s3 {font-variant-ligatures: no-common-ligatures; color: #ffffff}
    span.s4 {font-variant-ligatures: no-common-ligatures; color: #00afca}
    span.s5 {font-variant-ligatures: no-common-ligatures; color: #93c96a}
    span.s6 {font-variant-ligatures: no-common-ligatures; color: #8b84cf}
    span.s7 {font-variant-ligatures: no-common-ligatures; color: #4dbf56}
    span.s8 {font-variant-ligatures: no-common-ligatures; color: #e44347}


  • @IBAction ;func startMonitoringPressed(_ sender: Any) {

            startMonitoringButton.isEnabled = false

            stopMonitoringButton.isEnabled = true

            device.led?.flashColorAsync(UIColor.white, withIntensity: 1.0)

        

            updateAccelerometerBMI160Settings()

            device.accelerometer!.dataReadyEvent.startLoggingAsync()

    }

  • @IBAction ;func stopMonitoringPressed(_ sender: Any) {

            startMonitoringButton.isEnabled = true

            stopMonitoringButton.isEnabled = false

            device.led?.setLEDOnAsync(false, withOptions: 1)

            

            let hud = MBProgressHUD.showAdded(to: UIApplication.shared.keyWindow!, animated: true)

            hud.mode = .determinateHorizontalBar

            hud.label.text = "Downloading..."

            device.accelerometer!.dataReadyEvent.downloadLogAndStopLoggingAsync(true) { number in

                hud.progress = number

                }.success { array in

                    self.accelerometerBMI160Data = array as! [MBLAccelerometerData]

                    for obj in self.accelerometerBMI160Data {

                        self.accelerometerGraphView.addX(obj.x, y: obj.y, z: obj.z)

                    }

                    hud.mode = .indeterminate

                    hud.label.text = "Clearing Log..."

                    self.logCleanup { error in

                        hud.hide(animated: true)

                        if error != nil {

                            self.connectDevice(false)

                        }

                    }

    ...

  • ...

                }.failure { error in

                    self.connectDevice(false)

                    hud.hide(animated: true)

            }        

    }

  • edited August 2017
    The standard test app works, as well as the MetaBase app.  

    To scale down the app for my current project, I commented out several sections of code for the peripherals not being used.  

    The peripherals being used are:
    BMI160 Accelerometer + Gyroscope
    BME280 Humidity + Temperature
    LTR329ALS Light

    *I also commented out unused functions for the above peripherals (i.e. tap detection, orientation) 

    My app functions properly for streaming data from these devices.  And as I debug, I can see that data is being written into memory.  However, when I download the data from Memory the process lags.  I'm assuming it is hanging somewhere, but I dont know for sure.  

    I have tested both accelerometer and gyroscope logging, individually and together.  
  • edited August 2017
      
  • I tried running the device on the MetaBase app again, and it is now hanging on the download there as well.  

    I logged data for approximately 1 minute at the following configuration settings:
    Accelerometer (100 Hz)
    Gyroscope (100 Hz)
    Light (1 Hz)
    Humidity (1 s)
    Temperature (1 s)

    Because it got stuck in the download, I closed the app and restarted the device (removed the battery).  However, the device is still remembered as downloading and I am unable to log or stream any data.  But the connection was broken so the download gives me the following error:
    "Some devices failed to download, try those again later.  Unexpected error - could not load device configuration, please try again."


  • edited August 2017
    Reinstalling the MetaBase app should clear those error messages.  

    Does the log download consistently hang?  When the download does hang, is the board still connected to your iOS device and has the task ever called either the success or failure handlers?

    Do you have an Android device to test with?
  • The MetaBase long download no longer hangs.  

    My modified app does still hang.  The board is still connected to my iOS device.  The app never enters the success or failure handler.  
  • Try using the Starter template and only log and download one sensor.  If that works, then add another sensor.
This discussion has been closed.