// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x911c3(%rip), %rdi     # 0x10d446
callq 0x520bf
callq 0x51c63
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x8c3e4(%rip), %xmm0    # 0x108680
movsd %xmm0, -0x30(%rbp)
callq 0x51c47
movl %eax, %r12d
callq 0x51c47
movl %eax, %r15d
callq 0x51c47
movl %eax, %r14d
callq 0x51c47
movl %eax, %ebx
leaq 0x27b6ed(%rip), %r13    # 0x2f79b4
cmpl $0x0, (%r13)
je 0x7c38a
callq 0x51c63
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x8c39a(%rip), %xmm0    # 0x108680
leaq 0x27b793(%rip), %rax    # 0x2f7a80
movsd %xmm0, (%rax)
callq 0x51c63
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x8c37b(%rip), %xmm0    # 0x108680
leaq 0x27b77c(%rip), %rax    # 0x2f7a88
cmpl $0x0, (%r13)
movsd %xmm0, (%rax)
leaq 0x27a6e4(%rip), %rax    # 0x2f6a00
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x27afd0(%rip), %rax    # 0x2f72fc
movl $0x1, (%rax)
movzbl %r12b, %eax
cvtsi2sd %eax, %xmm0
mulsd 0x8c346(%rip), %xmm0    # 0x108688
addsd 0x8c346(%rip), %xmm0    # 0x108690
leaq 0x27a6c7(%rip), %rax    # 0x2f6a18
movsd %xmm0, (%rax)
leaq 0x27aef0(%rip), %rax    # 0x2f724c
movl $0x67, (%rax)
je 0x7c3d7
leaq 0x7e16d(%rip), %rax     # 0xfa4d8
leaq 0x8bb80(%rip), %rcx     # 0x107ef2
leaq 0x8bb74(%rip), %rdx     # 0x107eed
leaq 0x9cc41(%rip), %rsi     # 0x118fc1
movsd 0x8c318(%rip), %xmm0    # 0x1086a0
jmp 0x7c3fb
leaq 0x27a66f(%rip), %rax    # 0x2f6a00
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x27af5b(%rip), %rax    # 0x2f72fc
movzbl %r12b, %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0x8c2d7(%rip), %xmm0    # 0x108688
movl $0x1, (%rax)
addsd 0x8c2d1(%rip), %xmm0    # 0x108690
leaq 0x27a652(%rip), %rax    # 0x2f6a18
movsd %xmm0, (%rax)
leaq 0x27ae7b(%rip), %rax    # 0x2f724c
movl $0x67, (%rax)
leaq 0x7e0a2(%rip), %rax     # 0xfa480
leaq 0x91078(%rip), %rcx     # 0x10d45d
leaq 0x78a88(%rip), %rdx     # 0xf4e74
leaq 0xa0b2c(%rip), %rsi     # 0x11cf1f
movsd 0x8c29d(%rip), %xmm0    # 0x108698
movzbl %r15b, %edi
cvtsi2sd %edi, %xmm1
divsd %xmm0, %xmm1
movzbl %r14b, %edi
cvtsi2sd %edi, %xmm2
leaq 0x27b642(%rip), %rdi    # 0x2f7a58
movsd %xmm1, (%rdi)
divsd %xmm0, %xmm2
leaq 0x27b63b(%rip), %rdi    # 0x2f7a60
movsd %xmm2, (%rdi)
leaq 0xcb900(%rip), %rdi     # 0x147d30
movq %rsi, 0x830(%rdi)
movq %rdx, 0x828(%rdi)
movq %rcx, 0x910(%rdi)
movq %rax, 0x9f8(%rdi)
subsd %xmm1, %xmm2
mulsd 0x76c08(%rip), %xmm2    # 0xf3060
leaq 0x27b609(%rip), %rax    # 0x2f7a68
movzbl %bl, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm2, (%rax)
divsd 0x8c236(%rip), %xmm0    # 0x1086a8
leaq 0x27b617(%rip), %rax    # 0x2f7a90
movsd %xmm0, (%rax)
leaq 0x27b5f4(%rip), %rax    # 0x2f7a78
pushq $0x1
popq %rcx
movl %ecx, (%rax)
leaq 0x27b5e4(%rip), %rax    # 0x2f7a74
movl %ecx, (%rax)
leaq 0x27b5d7(%rip), %rax    # 0x2f7a70
movl %ecx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq