// File: jkingan[P]ladyheather/heathgps.cpp
// Function: set_nav_rate(double)
void set_nav_rate(DATA_SIZE hz)
{
   if(read_only) return;

   if(hz <= 0.0) hz = 1.0;

   if(rcvr_type == CS_RCVR) {
      if(!pause_data) nav_rate = hz;
   }
   else if((rcvr_type == NO_RCVR) || (rcvr_type == TIDE_RCVR) || (rcvr_type == THERMO_RCVR)) {
      if(!pause_data) nav_rate = hz;
   }
   else if(rcvr_type == NVS_RCVR) {
      send_nvs_start(0xD7); // set nav rate (1 Hz)
      send_byte(0x02);
      send_byte((u08) hz);
      send_nvs_end();
   }
   else if(rcvr_type == TICC_RCVR) {
      if(!pause_data) nav_rate = hz;
   }
   else if(rcvr_type == UBX_RCVR) {
      if(time_flags & TFLAGS_UTC) {       // sync to UTC time
         set_ubx_nav_rate((DATA_SIZE) 1000.0/hz, 1); // 1Hz, align to UTC
      }
      else {
         set_ubx_nav_rate((DATA_SIZE) 1000.0/hz, 0); // 1Hz, align to GPS
      }
   }
   else if(rcvr_type == VENUS_RCVR) {
      send_venus_start(SET_VENUS_OUT_RATE);
      send_byte(1);  // 1 Hz
      send_venus_save(1);
      Sleep(1000);

      // doing this causes the receiver to effectively warm start
      send_venus_start(SET_VENUS_NAV_RATE);
      send_byte((u08) hz);  // raw Hz !!!!
      send_venus_save(1);
   }

   log_written = 0;  // force new log header
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movsd %xmm0, -0x8(%rbp)
leaq 0x300506(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x95cfe
jmp 0x95ec9
xorps %xmm0, %xmm0
ucomisd -0x8(%rbp), %xmm0
jb 0x95d15
movsd 0xd9358(%rip), %xmm0    # 0x16f068
movsd %xmm0, -0x8(%rbp)
leaq 0x1e1d94(%rip), %rax    # 0x277ab0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0x95d46
leaq 0x1e46e8(%rip), %rax    # 0x27a414
cmpb $0x0, (%rax)
jne 0x95d41
movsd -0x8(%rbp), %xmm0
leaq 0x1e47fb(%rip), %rax    # 0x27a538
movsd %xmm0, (%rax)
jmp 0x95ebf
leaq 0x1e1d63(%rip), %rax    # 0x277ab0
cmpq $0x400, (%rax)          # imm = 0x400
je 0x95d76
leaq 0x1e1d53(%rip), %rax    # 0x277ab0
cmpq $0x800000, (%rax)       # imm = 0x800000
je 0x95d76
leaq 0x1e1d43(%rip), %rax    # 0x277ab0
cmpq $0x80000, (%rax)        # imm = 0x80000
jne 0x95d97
leaq 0x1e4697(%rip), %rax    # 0x27a414
cmpb $0x0, (%rax)
jne 0x95d92
movsd -0x8(%rbp), %xmm0
leaq 0x1e47aa(%rip), %rax    # 0x27a538
movsd %xmm0, (%rax)
jmp 0x95ebd
leaq 0x1e1d12(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x95dd2
movl $0xd7, %edi
callq 0x824f0
movl $0x2, %edi
callq 0x7b210
cvttsd2si -0x8(%rbp), %eax
movzbl %al, %edi
callq 0x7b210
callq 0x82630
jmp 0x95ebb
leaq 0x1e1cd7(%rip), %rax    # 0x277ab0
cmpq $0x10000, (%rax)        # imm = 0x10000
jne 0x95e03
leaq 0x1e462b(%rip), %rax    # 0x27a414
cmpb $0x0, (%rax)
jne 0x95dfe
movsd -0x8(%rbp), %xmm0
leaq 0x1e473e(%rip), %rax    # 0x27a538
movsd %xmm0, (%rax)
jmp 0x95eb9
leaq 0x1e1ca6(%rip), %rax    # 0x277ab0
cmpq $0x4, (%rax)
jne 0x95e50
leaq 0x2d686d(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x95e3a
movsd 0xd9207(%rip), %xmm0    # 0x16f030
divsd -0x8(%rbp), %xmm0
movl $0x1, %edi
callq 0x95ed0
jmp 0x95e4e
movsd 0xd91ee(%rip), %xmm0    # 0x16f030
divsd -0x8(%rbp), %xmm0
xorl %edi, %edi
callq 0x95ed0
jmp 0x95eb7
leaq 0x1e1c59(%rip), %rax    # 0x277ab0
cmpq $0x80, (%rax)
jne 0x95eb5
movl $0x11, %edi
movl $0x3, %esi
movl %esi, -0xc(%rbp)
callq 0x84080
movl $0x1, %edi
movl %edi, -0x10(%rbp)
callq 0x7b210
movl -0x10(%rbp), %edi
callq 0x84130
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xb8b0
movl -0xc(%rbp), %esi
movl $0xe, %edi
callq 0x84080
cvttsd2si -0x8(%rbp), %eax
movzbl %al, %edi
callq 0x7b210
movl $0x1, %edi
callq 0x84130
jmp 0x95eb7
jmp 0x95eb9
jmp 0x95ebb
jmp 0x95ebd
jmp 0x95ebf
leaq 0x207704(%rip), %rax    # 0x29d5ca
movb $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nop