function UBX_CFG_PM2(update,search) {
  log_debug("UBX_CFG_PM2()");

  // convert an integer to an array of bytes
  function int_2_bytes( x ){
    var bytes = [];
    var i = 4;
    do {
      bytes[--i] = x & (255);
      x = x>>8;
    } while (i);
    return bytes;
  }

  var u = int_2_bytes(update*1000);
  var s = int_2_bytes(search*1000);

  writeGPScmd([0x06, 0x3B,                /* class id */
               44, 0,                      /* length */
               0x01, 0x00, 0x00, 0x00,    /* v1, reserved 1..3 */
               0x00, 0x10, 0x00, 0x00,    /* on/off-mode, update ephemeris */
               u[3], u[2], u[1], u[0],    /* update period, ms, 120s=00 01 D4 C0, 30s= 00 00 75 30 */
               s[3], s[2], s[1], s[0],    /* search period, ms, 120s, 20s = 00 00 4E 20, 5s = 13 88 */
               0x00, 0x00, 0x00, 0x00,    /* grid offset */
               0x00, 0x00,              /* on-time after first fix */
               0x01, 0x00,                /* minimum acquisition time */
               0x00, 0x00, 0x00, 0x00,    /* reserved 4,5 */
               0x00, 0x00, 0x00, 0x00,    /* reserved 6 */
               0x00, 0x00, 0x00, 0x00,    /* reserved 7 */
               0x00, 0x00, 0x00, 0x00,    /* reserved 8,9,10 */
               0x00, 0x00, 0x00, 0x00]);  /* reserved 11 */
}
/*
 * Extended Power Management
 * update and search are in milli seconds
 * settings are loaded little endian, lsb first
 *
 * https://github.com/thasti/utrak/blob/master/gps.c
 */
Extended Power Management
update and search are in milli seconds
settings are loaded little endian, lsb first


Extended Power Management update and search are in milli seconds settings are loaded little endian lsb first
function UBX_CFG_PM2(update,search) {
  log_debug("UBX_CFG_PM2()");
  function int_2_bytes( x ){
    var bytes = [];
    var i = 4;
    do {
      bytes[--i] = x & (255);
      x = x>>8;
    } while (i);
    return bytes;
  }
  var u = int_2_bytes(update*1000);
  var s = int_2_bytes(search*1000);
  writeGPScmd([0x06, 0x3B,                
               44, 0,                      
               0x01, 0x00, 0x00, 0x00,    
               0x00, 0x10, 0x00, 0x00,    
               u[3], u[2], u[1], u[0],    
               s[3], s[2], s[1], s[0],    
               0x00, 0x00, 0x00, 0x00,    
               0x00, 0x00,              
               0x01, 0x00,                
               0x00, 0x00, 0x00, 0x00,    
               0x00, 0x00, 0x00, 0x00,    
               0x00, 0x00, 0x00, 0x00,    
               0x00, 0x00, 0x00, 0x00,    
               0x00, 0x00, 0x00, 0x00]);  
}
function UBX_CFG_PM2 ( update , search ) { log_debug ( "UBX_CFG_PM2()" ) ; function int_2_bytes ( x ) { var bytes = [ ] ; var i = 4 ; do { bytes [ -- i ] = x & ( 255 ) ; x = x >> 8 ; } while ( i ) ; return bytes ; } var u = int_2_bytes ( update * 1000 ) ; var s = int_2_bytes ( search * 1000 ) ; writeGPScmd ( [ 0x06 , 0x3B , 44 , 0 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x10 , 0x00 , 0x00 , u [ 3 ] , u [ 2 ] , u [ 1 ] , u [ 0 ] , s [ 3 ] , s [ 2 ] , s [ 1 ] , s [ 0 ] , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ] ) ; }
Extended Power Management
 update and search are in milli seconds
 settings are loaded little endian, lsb first
Extended Power Management update and search are in milli seconds settings are loaded little endian lsb first
// convert an integer to an array of bytes /* class id */ /* length */ /* v1, reserved 1..3 */ /* on/off-mode, update ephemeris */ /* update period, ms, 120s=00 01 D4 C0, 30s= 00 00 75 30 */ /* search period, ms, 120s, 20s = 00 00 4E 20, 5s = 13 88 */ /* grid offset */ /* on-time after first fix */ /* minimum acquisition time */ /* reserved 4,5 */ /* reserved 6 */ /* reserved 7 */ /* reserved 8,9,10 */ /* reserved 11 */