Reactivate the CF GPS after switching on

Discussion in 'Questions (Windows Mobile)' started by Scubaticus, Oct 16, 2007.

  1. Scubaticus

    Scubaticus Active Member Licensed User

    After I loaded my app, the GPS is actived and data is coming in.
    Now I leave the program open and switch my Ipaq off.

    When switching the Ipaq on again, with the app in memory, the CF GPS card is not activated.

    I tried to switch it back on by a timer event which does:

    Code:
    If Serial.PortOpen <> true Then Serial.PortOpen = true
    But after switching the device on, the Serial.PortOpen returns true, but the CF GPS is not.

    The only way to get the CF card back online is by issuing a
    Code:
    Serial.PortOpen = true
    (I created a Wakeup GPS button), but I want to do this automatically.

    Is there a way to do this?

    Scub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You could use a timer to check that data is coming from the GPS.
    If no data arrives after 5 seconds close the port and open it again.
     
  3. Scubaticus

    Scubaticus Active Member Licensed User

    But isn't it strage the GPS library status returns "A" when the CF card is not sending any data after switching the device on again?

    Scub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should only check the GPS values inside the GPSDecoded event.
    If the GPS stops sending data, the last values will continue to show.
     
  5. Scubaticus

    Scubaticus Active Member Licensed User

    Erel,

    To figure out if data is coming from serial after switching on the PPC with the application loaded in memory I use

    Code:
    If Serial.InBufferCount=0 Then WakeUpGPS_Click(false)
    After I switch off my PCC, the GPS CF light goes off (not initialized). After switching it on again, the GPS light stays off. The Serial.InBufferCount report 512 bytes over and over again, but how is that possible even when the GPS is still off.

    I only got it activated again after disposing serial, gps & converter and adding these objects again but as you will understand this is not wanted automatically.

    To me it looks like the serial object has a strange behaviour after switching power off and on again.

    Do you have any hints or clues?

    Scub
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Are you reading the data with a timer?
    Maybe the 512 bytes were still not read when you've turned off the device?
     
  7. Scubaticus

    Scubaticus Active Member Licensed User

    The Sub which disposed and created the new objects was starting with disableing the timers responseble for readed the serial. This was needed to prevent reading bytes from a disposed serial.

    So when switching the device off there was a big chance it was between disabling and enabling the timers, causing not read the serial ......

    Now I do an extra check: If there are bytes in the buffer AND if the timers are diabled, run the re-init GPS again.

    Now it works the way I had in mind.

    Thanks Erel!
     
Loading...