// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rbx
pushq %rax
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8c83
leaq 0x1962f0(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0xa8cf4
leaq 0x76e1b(%rip), %rcx     # 0x11fab0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7d27a(%rip), %rdi     # 0x125f1f
callq 0x58e77
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8cc0
leaq 0x1962b3(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x17256d(%rip), %rcx    # 0x21b234
cmpb $0x0, (%rcx)
jne 0xa8e8d
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
leaq 0x17267a(%rip), %rax    # 0x21b358
movsd %xmm0, (%rax)
leaq 0x2645e3(%rip), %rax    # 0x30d2cc
movl $0x3, (%rax)
jmp 0xa8e8d
leaq 0x7d255(%rip), %rdi     # 0x125f50
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x58e77
leaq 0x7d22f(%rip), %rdi     # 0x125f3c
callq 0x58e77
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8d2a
leaq 0x196249(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0xa8d40
leaq 0x196233(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x589b0
leaq 0x26501c(%rip), %rcx    # 0x30dd68
movl %eax, (%rcx)
xorl %ecx, %ecx
testb $0x8, %bl
sete %cl
leaq 0x264fbb(%rip), %rdx    # 0x30dd18
movl %ecx, (%rdx)
leaq 0x26457a(%rip), %rcx    # 0x30d2e0
movl $0x1, %edx
movl %edx, (%rcx)
leaq 0x264fec(%rip), %rcx    # 0x30dd60
movl %edx, (%rcx)
testl %eax, %eax
je 0xa8e15
leaq 0x264fe7(%rip), %rcx    # 0x30dd6c
movl %eax, (%rcx)
movb $0x1, %al
jmp 0xa8e17
leaq 0x7d193(%rip), %rdi     # 0x125f28
callq 0x58e77
callq 0x58aae
cvtss2sd %xmm0, %xmm0
leaq 0x2642f6(%rip), %rax    # 0x30d0a0
movsd %xmm0, (%rax)
jmp 0xa8e8d
leaq 0x7bdde(%rip), %rdi     # 0x124b98
callq 0x58e77
callq 0x58b86
divsd 0x60284(%rip), %xmm0    # 0x109050
leaq 0x264ff5(%rip), %rax    # 0x30ddc8
movsd %xmm0, (%rax)
leaq 0x2644d6(%rip), %rax    # 0x30d2b4
jmp 0xa8e87
leaq 0x7d15b(%rip), %rdi     # 0x125f45
callq 0x58e77
callq 0x588f0
movzwl %ax, %eax
leaq 0x1722ce(%rip), %rcx    # 0x21b0cc
movl %eax, (%rcx)
andl $0x3, %eax
leaq 0x1722b6(%rip), %rcx    # 0x21b0c0
movl %eax, (%rcx)
leaq 0x2645b5(%rip), %rax    # 0x30d3c8
jmp 0xa8e87
xorl %eax, %eax
leaq 0x264f02(%rip), %rcx    # 0x30dd20
movb %al, (%rcx)
leaq 0x2644b5(%rip), %rax    # 0x30d2dc
movl $0x14, (%rax)
leal -0x10(%rbx), %eax
shrb $0x4, %al
movzbl %al, %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jb 0xa8e53
cmpl $0x1, %eax
ja 0xa8e80
leaq 0x26465a(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
andl $-0x2, %eax
xorl %ecx, %ecx
jmp 0xa8e61
leaq 0x26464a(%rip), %rax    # 0x30d4a4
movl (%rax), %eax
orl $0x1, %eax
movb $0x3, %cl
leaq 0x26463c(%rip), %rdx    # 0x30d4a4
movl %eax, (%rdx)
leaq 0x26464c(%rip), %rax    # 0x30d4bd
movb %cl, (%rax)
leaq 0x264552(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
leaq 0x264549(%rip), %rax    # 0x30d3d0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq