// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_rftg_voltages()
void parse_rftg_voltages()
{
double ctrl;
int b1,b2,b3,b4;

   log_packet_id("Packet 0x23 (voltages)");

   ctrl = ((double) (u16) tsip_word()) / 3276.8;  // counter?
   b1 = tsip_byte(); 
   b2 = tsip_byte(); 
   b3 = tsip_byte(); 
   b4 = tsip_byte(); 

   // these two are only sent by the XO unit
   if(rftg_unit != 0) {
      rftg_adc = ((double) (u16) tsip_word()) / 3276.8;  // counter?
      rftg_dac_5min = ((double) (u16) tsip_word()) / 3276.8;  // counter?
   }

   dac_voltage = (DATA_SIZE) ctrl;
   have_dac = 1;
   temperature = (DATA_SIZE) (((double)b1 * 1.5024) - 273.0);
   have_temperature = 103;

   if(rftg_unit == 0) {
      ant_v1 = ((double) b2) / 15.44571833;  // lamp V
      ant_v2 = ((double) b3) / 15.44571833;  // xtal V
      plot[SIX].units = "--";       // meaningless number for Rb unit
      plot[SIX].plot_id = "---";
      plot[SEVEN].plot_id = "LampV";
      plot[EIGHT].plot_id = "OcxoV";
   }
   else {
      ant_v1 = ((double) b2) / 50.0486431;   // fault1 V
      ant_v2 = ((double) b3) / 50.0486431;   // fault2 V
      plot[SIX].units = "mA";
      plot[SIX].plot_id = "AntI";
      plot[SEVEN].plot_id = "AntV1";
      plot[EIGHT].plot_id = "AntV2";
   }
   ant_ma = (ant_v2 - ant_v1) * 100.0;  // antenna current

   rftg_oscv = ((double) b4) / 7.121011923;
   have_ant_v1 = have_ant_v2 = have_ant_ma = 1;

//sprintf(debug_text3, "rftg23: %.5f %d->%.5f %d->%.5f %d->%.5f %d->%.5f  adc:%.5f  dac5:%.5f", ctrl, b1,temperature, b2,ant_v1, b3,ant_v2, b4,rftg_oscv, rftg_adc,rftg_dac_5min);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0xcbd06(%rip), %rdi     # 0x1867e5
callq 0x7add0
callq 0x7a560
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
movsd 0xc84f0(%rip), %xmm1    # 0x182fe8
divsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0xc(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x10(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x14(%rbp)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x18(%rbp)
leaq 0x2b2060(%rip), %rax    # 0x36cb94
cmpl $0x0, (%rax)
je 0xbab7f
callq 0x7a560
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
movsd 0xc849b(%rip), %xmm1    # 0x182fe8
divsd %xmm1, %xmm0
leaq 0x2b2108(%rip), %rax    # 0x36cc60
movsd %xmm0, (%rax)
callq 0x7a560
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
movsd 0xc8478(%rip), %xmm1    # 0x182fe8
divsd %xmm1, %xmm0
leaq 0x2b20ed(%rip), %rax    # 0x36cc68
movsd %xmm0, (%rax)
movsd -0x8(%rbp), %xmm0
leaq 0x2b1055(%rip), %rax    # 0x36bbe0
movsd %xmm0, (%rax)
leaq 0x2b1946(%rip), %rax    # 0x36c4dc
movl $0x1, (%rax)
cvtsi2sdl -0xc(%rbp), %xmm0
movsd 0xc8447(%rip), %xmm1    # 0x182ff0
mulsd %xmm1, %xmm0
movsd 0xc8443(%rip), %xmm1    # 0x182ff8
addsd %xmm1, %xmm0
leaq 0x2b1038(%rip), %rax    # 0x36bbf8
movsd %xmm0, (%rax)
leaq 0x2b1861(%rip), %rax    # 0x36c42c
movl $0x67, (%rax)
leaq 0x2b1fbc(%rip), %rax    # 0x36cb94
cmpl $0x0, (%rax)
jne 0xbac72
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0xc841a(%rip), %xmm1    # 0x183008
divsd %xmm1, %xmm0
leaq 0x2b203f(%rip), %rax    # 0x36cc38
movsd %xmm0, (%rax)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0xc83fe(%rip), %xmm1    # 0x183008
divsd %xmm1, %xmm0
leaq 0x2b202b(%rip), %rax    # 0x36cc40
movsd %xmm0, (%rax)
leaq 0x102100(%rip), %rax    # 0x1bcd20
leaq 0xdaf3c(%rip), %rcx     # 0x195b63
movq %rcx, 0x830(%rax)
leaq 0x1020eb(%rip), %rax    # 0x1bcd20
leaq 0xb61aa(%rip), %rcx     # 0x170de6
movq %rcx, 0x828(%rax)
leaq 0x1020d6(%rip), %rax    # 0x1bcd20
leaq 0xcbbab(%rip), %rcx     # 0x1867fc
movq %rcx, 0x910(%rax)
leaq 0x1020c1(%rip), %rax    # 0x1bcd20
leaq 0xba0f7(%rip), %rcx     # 0x174d5d
movq %rcx, 0x9f8(%rax)
jmp 0xbacfe
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0xc8381(%rip), %xmm1    # 0x183000
divsd %xmm1, %xmm0
leaq 0x2b1fae(%rip), %rax    # 0x36cc38
movsd %xmm0, (%rax)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0xc8365(%rip), %xmm1    # 0x183000
divsd %xmm1, %xmm0
leaq 0x2b1f9a(%rip), %rax    # 0x36cc40
movsd %xmm0, (%rax)
leaq 0x10206f(%rip), %rax    # 0x1bcd20
leaq 0xd6ee5(%rip), %rcx     # 0x191b9d
movq %rcx, 0x830(%rax)
leaq 0x10205a(%rip), %rax    # 0x1bcd20
leaq 0xc7bbc(%rip), %rcx     # 0x182889
movq %rcx, 0x828(%rax)
leaq 0x102045(%rip), %rax    # 0x1bcd20
leaq 0xc7bac(%rip), %rcx     # 0x18288e
movq %rcx, 0x910(%rax)
leaq 0x102030(%rip), %rax    # 0x1bcd20
leaq 0xba0be(%rip), %rcx     # 0x174db5
movq %rcx, 0x9f8(%rax)
leaq 0x2b1f3b(%rip), %rax    # 0x36cc40
movsd (%rax), %xmm0
leaq 0x2b1f28(%rip), %rax    # 0x36cc38
subsd (%rax), %xmm0
movsd 0xb4334(%rip), %xmm1    # 0x16f050
mulsd %xmm1, %xmm0
leaq 0x2b1f21(%rip), %rax    # 0x36cc48
movsd %xmm0, (%rax)
cvtsi2sdl -0x18(%rbp), %xmm0
movsd 0xc82d8(%rip), %xmm1    # 0x183010
divsd %xmm1, %xmm0
leaq 0x2b1f2d(%rip), %rax    # 0x36cc70
movsd %xmm0, (%rax)
leaq 0x2b1f0a(%rip), %rax    # 0x36cc58
movl $0x1, (%rax)
leaq 0x2b1ef9(%rip), %rax    # 0x36cc54
movl $0x1, (%rax)
leaq 0x2b1ee8(%rip), %rax    # 0x36cc50
movl $0x1, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)