// File: /workspace/github_cpp_makefile_star2_O3/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 0x9ad41(%rip), %rdi     # 0x1234fe
callq 0x58dc2
callq 0x588d2
movl %eax, %ebx
callq 0x587be
movl %eax, %r12d
cmpl $0x100, %eax            # imm = 0x100
jb 0x887e2
leaq 0x1b6791(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587be
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x887fb
leaq 0x1b6778(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
movzwl %bx, %ebx
callq 0x587be
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x88817
leaq 0x1b675c(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
cvtsi2sd %ebx, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x88838
leaq 0x1b673b(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
movsd -0x30(%rbp), %xmm0
divsd 0x95ec3(%rip), %xmm0    # 0x11e708
leaq 0x285168(%rip), %r13    # 0x30d9b4
cmpl $0x0, (%r13)
je 0x8891d
movsd %xmm0, -0x30(%rbp)
callq 0x588d2
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x95e95(%rip), %xmm0    # 0x11e708
leaq 0x285206(%rip), %rax    # 0x30da80
movsd %xmm0, (%rax)
callq 0x588d2
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x95e73(%rip), %xmm0    # 0x11e708
leaq 0x2851ec(%rip), %rax    # 0x30da88
cmpl $0x0, (%r13)
movsd %xmm0, (%rax)
leaq 0x284154(%rip), %rax    # 0x30ca00
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x284a40(%rip), %rax    # 0x30d2fc
movl $0x1, (%rax)
movzbl %r12b, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x95e3b(%rip), %xmm0    # 0x11e710
addsd 0x95e3b(%rip), %xmm0    # 0x11e718
leaq 0x284134(%rip), %rax    # 0x30ca18
movsd %xmm0, (%rax)
leaq 0x28495d(%rip), %rax    # 0x30d24c
movl $0x67, (%rax)
je 0x88968
leaq 0x87b5a(%rip), %rax     # 0x110458
leaq 0x9556d(%rip), %rcx     # 0x11de72
leaq 0x95561(%rip), %rdx     # 0x11de6d
leaq 0xa678e(%rip), %rsi     # 0x12f0a1
movsd 0x95e0d(%rip), %xmm0    # 0x11e728
jmp 0x8898c
leaq 0x2840dc(%rip), %rax    # 0x30ca00
movsd %xmm0, (%rax)
leaq 0x2849cd(%rip), %rax    # 0x30d2fc
movzbl %r12b, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x95dce(%rip), %xmm0    # 0x11e710
movl $0x1, (%rax)
addsd 0x95dc8(%rip), %xmm0    # 0x11e718
leaq 0x2840c1(%rip), %rax    # 0x30ca18
movsd %xmm0, (%rax)
leaq 0x2848ea(%rip), %rax    # 0x30d24c
movl $0x67, (%rax)
leaq 0x87a91(%rip), %rax     # 0x110400
leaq 0x9ab9f(%rip), %rcx     # 0x123515
leaq 0x8247c(%rip), %rdx     # 0x10adf9
leaq 0xaa67b(%rip), %rsi     # 0x132fff
movsd 0x95d94(%rip), %xmm0    # 0x11e720
movl $0xff, %edi
andl %edi, %r14d
cvtsi2sd %r14d, %xmm1
divsd %xmm0, %xmm1
leaq 0x2850b4(%rip), %r8     # 0x30da58
andl %edi, %r15d
cvtsi2sd %r15d, %xmm2
movsd %xmm1, (%r8)
divsd %xmm0, %xmm2
leaq 0x2850a4(%rip), %r8     # 0x30da60
movsd %xmm2, (%r8)
leaq 0xd5368(%rip), %r8      # 0x15dd30
movq %rsi, 0x830(%r8)
movq %rdx, 0x828(%r8)
movq %rcx, 0x910(%r8)
movq %rax, 0x9f8(%r8)
subsd %xmm1, %xmm2
mulsd 0x80670(%rip), %xmm2    # 0x109060
leaq 0x285071(%rip), %rax    # 0x30da68
andl %edi, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm2, (%rax)
divsd 0x95d24(%rip), %xmm0    # 0x11e730
leaq 0x28507d(%rip), %rax    # 0x30da90
movsd %xmm0, (%rax)
leaq 0x28505a(%rip), %rax    # 0x30da78
movl $0x1, %ecx
movl %ecx, (%rax)
leaq 0x285048(%rip), %rax    # 0x30da74
movl %ecx, (%rax)
leaq 0x28503b(%rip), %rax    # 0x30da70
movl %ecx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq