 
 #define NOP __asm__ __volatile__("nop\n\t")
 
-int beacon_init_count = 10 ;
+int beacon_init_count = 100 ;
 
 unsigned long update_beacon = UPDATE_BEACON_INIT ;
 

#include <LibAPRS.h>
#include <TinyGPSplus.h>
#include <DRA818.h>

#define VERSION "Beta-0.93"

#define ADC_REFERENCE REF_5V



}

char  lat[] =  "0000.00N" ;
char  lon[] = "00000.00W" ;
int h = 0 ;

void loop()
{


   while(Serial.available() > 0 ) {
       if(gps.encode(Serial.read())) {
           if( gps.location.isValid()) {

               // latitude
               if ( gps.location.rawLat().negative ) {
                   dtostrf(-100* gps.location.lat(),7,2,lat) ;
                   lat[7] = 'S';
               } else {
                   dtostrf(100*gps.location.lat(),7,2,lat) ;
                   lat[7] = 'N';
               }
               // longitude
               if ( gps.location.rawLng().negative ) {
                   dtostrf(-100*gps.location.lng(),8,2,lon) ;
                   lon[8] = 'W';
               } else {
                   dtostrf(100*gps.location.lng(),8,2,lon) ;
                   lon[8] = 'E';
               }

           }

           // altitude 
           if ( gps.altitude.isValid() ) {
               h = (int) gps.altitude.meters() ;
           }

       }
   }

   if ( millis() - lastupdate > update_beacon ) {
     lastupdate = millis() ;
     if ( beacon_init_count-- <= -1 ) {
        update_beacon = UPDATE_BEACON ;
     }
     // const char * lat =  "3742.44N" ;
     // const char * lon = "12157.54W" ;
     // 

     if ( gps.location.isValid() )  {
#ifdef OPTION_LCD
         lcd.clear();
         lcd.print(F("sending packet"));
#endif
         locationUpdate(lat,lon,h,1,0,0) ;
         // mydelay(250UL);
         // dra.setPTT(LOW);
         sent_count++ ;
#ifdef OPTION_LCD
         lcd.clear();
         lcd.print(F("s: ")) ;
         lcd.print(sent_count) ;
         lcd.print(F(" r: ")) ;
         lcd.print(recv_count) ;
         lcd.setCursor(0,1);
         lcd.print(lat) ;
#endif
     } else {
         lcd.clear();
         lcd.print(F("gps not ready")) ;
     } 
   }

   processPacket() ;
