// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_nvs_rcvr_config()
void parse_nvs_rcvr_config()
{
u08 sub_code;
u16 flags;
u08 keep;
u08 scale;
float rate;

   // 0xE7 packet

   sub_code = tsip_byte();
   if(sub_code == 0x02) {
      log_packet_id("nav rate");
      rate = (float) tsip_byte();
      if(!pause_data) {
         nav_rate = rate;
         have_nav_rate = 3;
      }
   }
   else if(sub_code == 0x04) {  // solution filtration factor
      log_packet_id("solution filtration");
      nvs_filter = tsip_single();
   }
   else if(sub_code == 0x05) {  // pps info
      log_packet_id("pps info");
      flags = tsip_byte();
      keep = tsip_byte();
      nvs_pps_width = tsip_dword();

      if(flags & 0x08) pps_polarity = 0; // positive
      else             pps_polarity = 1; // inverted
      have_pps_polarity = 1;
      have_pps_freq = 0x01;

      if(nvs_pps_width) {
         last_nvs_pps_width = nvs_pps_width;
         pps_enabled = 1;
      }
      else pps_enabled = 0;
      have_pps_enable = 20;

      scale = flags & 0xF0;
      if((scale == 0x10) || (scale == 0x20)) {  // GPS/GLONASS time
         time_flags &= (~TFLAGS_UTC);
         timing_mode = TMODE_GPS;
         have_timing_mode = 1;
      }
      else if((scale == 0x30) || (scale == 0x40)) {  // UTC
         time_flags |= (TFLAGS_UTC);
         timing_mode = TMODE_UTC;
         have_timing_mode = 1;
      }
      have_rcvr_tmode = 1;
//sprintf(plot_title, "pps flags:%02X  keep:%02X  width:%d", flags,keep,nvs_pps_width);  // qqqqqqqqqqqqqq
   }
   else if(sub_code == 0x06) {  // cable delay
      log_packet_id("cable delay");
      cable_delay = tsip_double() / 1.0E6;
//    if(have_cable_delay == 0) need_redraw = 2237;
      have_cable_delay = 1;
   }
   else if(sub_code == 0x07) {  // TRAIM mode, 2D OK, single sat OK
      log_packet_id("traim mode");
      flags = tsip_word();
      nvs_traim = flags;
      traim_mode = flags & 0x03;
      have_traim = 1;
   }
   else {
      log_packet_id("unsupported config subcode");
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x7a510
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
cmpl $0x2, %eax
jne 0xe4f08
leaq 0xa4492(%rip), %rdi     # 0x189352
callq 0x7add0
callq 0x7a510
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0xc(%rbp)
leaq 0x195537(%rip), %rax    # 0x27a414
cmpb $0x0, (%rax)
jne 0xe4f03
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x195646(%rip), %rax    # 0x27a538
movsd %xmm0, (%rax)
leaq 0x2875af(%rip), %rax    # 0x36c4ac
movl $0x3, (%rax)
jmp 0xe5132
movzbl -0x1(%rbp), %eax
cmpl $0x4, %eax
jne 0xe4f36
leaq 0xa4443(%rip), %rdi     # 0x18935b
callq 0x7add0
callq 0x7a860
cvtss2sd %xmm0, %xmm0
leaq 0x287353(%rip), %rax    # 0x36c280
movsd %xmm0, (%rax)
jmp 0xe5130
movzbl -0x1(%rbp), %eax
cmpl $0x5, %eax
jne 0xe5094
leaq 0xa4425(%rip), %rdi     # 0x18936f
callq 0x7add0
callq 0x7a510
movzbl %al, %eax
movw %ax, -0x4(%rbp)
callq 0x7a510
movb %al, -0x5(%rbp)
callq 0x7a680
movl %eax, %ecx
leaq 0x287fd7(%rip), %rax    # 0x36cf48
movl %ecx, (%rax)
movzwl -0x4(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xe4f8e
leaq 0x287f72(%rip), %rax    # 0x36cef8
movl $0x0, (%rax)
jmp 0xe4f9b
leaq 0x287f63(%rip), %rax    # 0x36cef8
movl $0x1, (%rax)
leaq 0x28751e(%rip), %rax    # 0x36c4c0
movl $0x1, (%rax)
leaq 0x287f91(%rip), %rax    # 0x36cf40
movl $0x1, (%rax)
leaq 0x287f8c(%rip), %rax    # 0x36cf48
cmpl $0x0, (%rax)
je 0xe4fdf
leaq 0x287f80(%rip), %rax    # 0x36cf48
movl (%rax), %ecx
leaq 0x287f7b(%rip), %rax    # 0x36cf4c
movl %ecx, (%rax)
leaq 0x287f26(%rip), %rax    # 0x36cf00
movb $0x1, (%rax)
jmp 0xe4fe9
leaq 0x287f1a(%rip), %rax    # 0x36cf00
movb $0x0, (%rax)
leaq 0x2874cc(%rip), %rax    # 0x36c4bc
movl $0x14, (%rax)
movzwl -0x4(%rbp), %eax
andl $0xf0, %eax
movb %al, -0x6(%rbp)
movzbl -0x6(%rbp), %eax
cmpl $0x10, %eax
je 0xe5014
movzbl -0x6(%rbp), %eax
cmpl $0x20, %eax
jne 0xe5042
leaq 0x287669(%rip), %rax    # 0x36c684
movl (%rax), %ecx
andl $-0x2, %ecx
leaq 0x28765d(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
leaq 0x28766d(%rip), %rax    # 0x36c69d
movb $0x0, (%rax)
leaq 0x287572(%rip), %rax    # 0x36c5ac
movl $0x1, (%rax)
jmp 0xe5082
movzbl -0x6(%rbp), %eax
cmpl $0x30, %eax
je 0xe5054
movzbl -0x6(%rbp), %eax
cmpl $0x40, %eax
jne 0xe5080
leaq 0x287629(%rip), %rax    # 0x36c684
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x28761d(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
leaq 0x28762d(%rip), %rax    # 0x36c69d
movb $0x3, (%rax)
leaq 0x287532(%rip), %rax    # 0x36c5ac
movl $0x1, (%rax)
jmp 0xe5082
leaq 0x287527(%rip), %rax    # 0x36c5b0
movl $0x1, (%rax)
jmp 0xe512e
movzbl -0x1(%rbp), %eax
cmpl $0x6, %eax
jne 0xe50d4
leaq 0xa2ec0(%rip), %rdi     # 0x187f64
callq 0x7add0
callq 0x7a9d0
movsd 0x89f8a(%rip), %xmm1    # 0x16f040
divsd %xmm1, %xmm0
leaq 0x287ee7(%rip), %rax    # 0x36cfa8
movsd %xmm0, (%rax)
leaq 0x2873c8(%rip), %rax    # 0x36c494
movl $0x1, (%rax)
jmp 0xe512c
movzbl -0x1(%rbp), %eax
cmpl $0x7, %eax
jne 0xe511e
leaq 0xa4294(%rip), %rdi     # 0x189378
callq 0x7add0
callq 0x7a560
movw %ax, -0x4(%rbp)
movzwl -0x4(%rbp), %ecx
leaq 0x1951af(%rip), %rax    # 0x27a2ac
movl %ecx, (%rax)
movzwl -0x4(%rbp), %ecx
andl $0x3, %ecx
leaq 0x195193(%rip), %rax    # 0x27a2a0
movl %ecx, (%rax)
leaq 0x287492(%rip), %rax    # 0x36c5a8
movl $0x1, (%rax)
jmp 0xe512a
leaq 0xa425e(%rip), %rdi     # 0x189383
callq 0x7add0
jmp 0xe512c
jmp 0xe512e
jmp 0xe5130
jmp 0xe5132
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)