// File: jkingan[P]ladyheather/heathui.cpp
// Function: edit_cal()
void edit_cal()
{
DATA_SIZE m, b;
char *s;

   // get a plot center line reference value
   s = plot[selected_plot].plot_id;
   edit_buffer[0] = 0;

   if     (selected_plot == TEMP)  { m=temp1_m; b=temp1_b; }
   else if(selected_plot == TC2)   { m=temp2_m; b=temp2_b; }
   else if(selected_plot == BATTI) { m=batti_m; b=batti_b; }
   else if(selected_plot == LEDI)  { m=ledi_m;  b=ledi_b; }
   else if(selected_plot == BATTV) { m=vcal_m;  b=vcal_b; s="VCAL"; }
   else if(selected_plot == LUX1)  { m=lux1_m;  b=lux1_b; }
   else if(selected_plot == LUX2)  { m=lux2_m;  b=lux2_b; }
   else if(selected_plot == AUXV)  { m=adc2_m;  b=adc2_b; }
   else if(selected_plot == CCT)   { m=rb_m;    b=rb_b; }
   else {
      sprintf(out, "%s does not have a calibration adjustment!", s);
      edit_error(out);
      return;
   }

   if(cal_mode) {
//    sprintf(edit_buffer, "%f  %f", m,b);
      edit_buffer[0] = 0;
      sprintf(out, "Enter reading1 actual1 reading2 actual2 for %s (m=%f b=%f)", s, m,b);
   }
   else {
      sprintf(edit_buffer, "%f  %f", m,b);
      sprintf(out, "Enter m and b cal factors for %s (m=%f b=%f)", s, m,b);
   }
   start_edit(CAL_CMD, out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x35cfc9(%rip), %rax    # 0x39ef38
movslq (%rax), %rcx
leaq 0x17ada7(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0x35c52f(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax)
leaq 0x35cf9d(%rip), %rax    # 0x39ef38
cmpl $0x3, (%rax)
jne 0x41fc5
leaq 0x2383a9(%rip), %rax    # 0x27a350
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x2383a1(%rip), %rax    # 0x27a358
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x4218c
leaq 0x35cf6c(%rip), %rax    # 0x39ef38
cmpl $0x8, (%rax)
jne 0x41ff6
leaq 0x238388(%rip), %rax    # 0x27a360
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x238380(%rip), %rax    # 0x27a368
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x4218a
leaq 0x35cf3b(%rip), %rax    # 0x39ef38
cmpl $0x1, (%rax)
jne 0x42027
leaq 0x238377(%rip), %rax    # 0x27a380
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x23836f(%rip), %rax    # 0x27a388
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x42188
leaq 0x35cf0a(%rip), %rax    # 0x39ef38
cmpl $0x6, (%rax)
jne 0x42058
leaq 0x238356(%rip), %rax    # 0x27a390
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x23834e(%rip), %rax    # 0x27a398
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x42186
leaq 0x35ced9(%rip), %rax    # 0x39ef38
cmpl $0x2, (%rax)
jne 0x42094
leaq 0x238305(%rip), %rax    # 0x27a370
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x2382fd(%rip), %rax    # 0x27a378
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x13753c(%rip), %rax    # 0x1795c7
movq %rax, -0x18(%rbp)
jmp 0x42184
leaq 0x35ce9d(%rip), %rax    # 0x39ef38
cmpl $0x0, (%rax)
jne 0x420c5
leaq 0x2382f9(%rip), %rax    # 0x27a3a0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x2382f1(%rip), %rax    # 0x27a3a8
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x42182
leaq 0x35ce6c(%rip), %rax    # 0x39ef38
cmpl $0x4, (%rax)
jne 0x420f6
leaq 0x2382d8(%rip), %rax    # 0x27a3b0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x2382d0(%rip), %rax    # 0x27a3b8
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x42180
leaq 0x35ce3b(%rip), %rax    # 0x39ef38
cmpl $0xd, (%rax)
jne 0x42124
leaq 0x2382b7(%rip), %rax    # 0x27a3c0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x2382af(%rip), %rax    # 0x27a3c8
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x4217e
leaq 0x35ce0d(%rip), %rax    # 0x39ef38
cmpl $0x12, (%rax)
jne 0x42152
leaq 0x238299(%rip), %rax    # 0x27a3d0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
leaq 0x238291(%rip), %rax    # 0x27a3d8
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x4217c
movq -0x18(%rbp), %rdx
leaq 0x3592a3(%rip), %rdi    # 0x39b400
leaq 0x137468(%rip), %rsi    # 0x1795cc
movb $0x0, %al
callq 0x9060
leaq 0x35928e(%rip), %rdi    # 0x39b400
callq 0x30d60
jmp 0x4221a
jmp 0x4217e
jmp 0x42180
jmp 0x42182
jmp 0x42184
jmp 0x42186
jmp 0x42188
jmp 0x4218a
jmp 0x4218c
leaq 0x329e95(%rip), %rax    # 0x36c028
cmpb $0x0, (%rax)
je 0x421c7
leaq 0x35c321(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax)
movq -0x18(%rbp), %rdx
movsd -0x8(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
leaq 0x359249(%rip), %rdi    # 0x39b400
leaq 0x137439(%rip), %rsi    # 0x1795f7
movb $0x2, %al
callq 0x9060
jmp 0x42209
movsd -0x8(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
leaq 0x35c2e8(%rip), %rdi    # 0x39e4c0
leaq 0x137453(%rip), %rsi    # 0x179632
movb $0x2, %al
callq 0x9060
movq -0x18(%rbp), %rdx
movsd -0x8(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
leaq 0x359205(%rip), %rdi    # 0x39b400
leaq 0x137437(%rip), %rsi    # 0x179639
movb $0x2, %al
callq 0x9060
movl $0x140, %edi            # imm = 0x140
leaq 0x3591eb(%rip), %rsi    # 0x39b400
callq 0x3d470
addq $0x20, %rsp
popq %rbp
retq