$correctionparams = getCorrectionParameters($angle, $length); if ($correctionparams['correction_needed']) { $needscorrection = true; $startcorrectionat = $correctionparams['start_at']; $endcorrectionat = $correctionparams['end_at']; $correcthead = $correctionparams['heading_offset']; $correctbank = $correctionparams['bank']; echo "correction:\n"; echo "start correction at: {$startcorrectionat}\n"; echo "end correction at: {$endcorrectionat}\n"; } else { echo "no correction needed.\n"; $needscorrection = false; } echo "############\n"; plot($lift); unset($lift); $gone = false; $correctionstarted = false; } } $needscorrection = false; if ($needscorrection && !$correctionstarted && abs($heading - $startcorrectionat) + $triggerdeg / 2 < $triggerdeg) { // start correction $rolldeg = getBankAngle($leftturn, $correctbank); $correctionstarted = true; } if ($needscorrection && $correctionstarted && abs($heading - $endcorrectionat) + $triggerdeg / 2 < $triggerdeg) { // end correction $rolldeg = getBankAngle($leftturn, $bankangle); }
function branchPlot($bcode, $tabname) { $result = mysql_query("select * from {$tabname} where (select srno REGEXP '......{$bcode}..') = 1 group by(srno)"); //echo "select * from $tabname where (select srno REGEXP '......$bcode..') = 1 group by(srno)"; $data = array(); $past = ""; $check = 0; $i = 0; $fail = 0; $pass = 0; if (mysql_num_rows($result) > 0) { echo "<h3><a href='?tabname={$tabname}&view=branch&bcode={$bcode}'>Branch - {$bcode}</h3><br><br>"; for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); $current = $row["srno"]; if ($current != $past && $i != 0) { if ($check == 0) { $pass++; } else { $fail++; } $check = 0; } if ($row["cre"] == 0) { $check = -1; } } if ($check == 0) { $pass++; } else { $fail++; } plot($pass, $fail, "ALL CLEAR", "FAIL"); return 1; } return 0; }