// File: jkingan[P]ladyheather/heathgps.cpp
// Function: send_esip_cmd(char*)
void send_esip_cmd(char *s)
{
int p;

   if(s == 0) return;

   if(debug_file) fprintf(debug_file, "Sent eSIP:%s\n", s);

   send_nmea_start();
   if(s[0] == '$')    send_nmea_string(&s[1], 0);
   else               send_nmea_string(&s[0], 0);
   if(strchr(s, '*')) send_nmea_end(0);
   else               send_nmea_end(1);

   if(ESIP_SLEEP) Sleep(ESIP_SLEEP);

   s = strstr(s, "PERDCFG,UART1");  // baud rate change command was just sent
   if(s) {  // adjust com port setting
      Sleep(1000);
      s += 14;   // skip over the command and get the baud rate
      p = atoi(s);

      if     (p == 4800) ;
      else if(p == 9600) ;
      else if(p == 19200) ;
      else if(p == 38400) ;
      else if(p == 57600) ;
      else if(p == 115200) ;
      else if(p == 230400) ;
      else p = 0;
      if(p) {
         have_doppler = 0;
         have_range = 0;
         com[RCVR_PORT].baud_rate = p;
         init_com(RCVR_PORT, 100);
         Sleep(800);
         need_redraw = 9600;
         init_receiver(9600, 0);   // setup the receiver
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x830e8
jmp 0x8326a
leaq 0x21a481(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0x83111
leaq 0x21a474(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x1006d7(%rip), %rsi    # 0x1837e1
movb $0x0, %al
callq 0x9550
callq 0x83880
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x24, %eax
jne 0x83133
movq -0x8(%rbp), %rdi
addq $0x1, %rdi
xorl %esi, %esi
callq 0x82750
jmp 0x8313e
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x82750
movq -0x8(%rbp), %rdi
movl $0x2a, %esi
callq 0x9100
cmpq $0x0, %rax
je 0x8315b
xorl %edi, %edi
callq 0x838a0
jmp 0x83165
movl $0x1, %edi
callq 0x838a0
movq -0x8(%rbp), %rdi
leaq 0x10067f(%rip), %rsi    # 0x1837ef
callq 0x9090
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x8326a
movl $0x3e8, %edi            # imm = 0x3E8
callq 0xb8b0
movq -0x8(%rbp), %rax
addq $0xe, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x95c0
movl %eax, -0xc(%rbp)
cmpl $0x12c0, -0xc(%rbp)     # imm = 0x12C0
jne 0x831b1
jmp 0x83206
cmpl $0x2580, -0xc(%rbp)     # imm = 0x2580
jne 0x831bc
jmp 0x83204
cmpl $0x4b00, -0xc(%rbp)     # imm = 0x4B00
jne 0x831c7
jmp 0x83202
cmpl $0x9600, -0xc(%rbp)     # imm = 0x9600
jne 0x831d2
jmp 0x83200
cmpl $0xe100, -0xc(%rbp)     # imm = 0xE100
jne 0x831dd
jmp 0x831fe
cmpl $0x1c200, -0xc(%rbp)    # imm = 0x1C200
jne 0x831e8
jmp 0x831fc
cmpl $0x38400, -0xc(%rbp)    # imm = 0x38400
jne 0x831f3
jmp 0x831fa
movl $0x0, -0xc(%rbp)
jmp 0x831fc
jmp 0x831fe
jmp 0x83200
jmp 0x83202
jmp 0x83204
jmp 0x83206
cmpl $0x0, -0xc(%rbp)
je 0x83268
leaq 0x2e930d(%rip), %rax    # 0x36c520
movl $0x0, (%rax)
leaq 0x2e9308(%rip), %rax    # 0x36c528
movl $0x0, (%rax)
movl -0xc(%rbp), %ecx
leaq 0x2ea290(%rip), %rax    # 0x36d4c0
movl %ecx, 0x159d0(%rax)
movl $0xa, %edi
movl $0x64, %esi
callq 0xc0e0
movl $0x320, %edi            # imm = 0x320
callq 0xb8b0
leaq 0x1f47ce(%rip), %rax    # 0x277a24
movl $0x2580, (%rax)         # imm = 0x2580
movl $0x2580, %edi           # imm = 0x2580
xorl %esi, %esi
callq 0x841a0
jmp 0x8326a
addq $0x10, %rsp
popq %rbp
retq