private void timerPoll_Tick(object sender, EventArgs e) { if (connection_ != null) { byte mode; if (mode_ == PWM_ALT) { mode = M_ALT; } else if (mode_ == PWM_AZM) { mode = M_AZM; } else { mode = mode_; } SendCommand(connection_, new byte[] { (byte)'P', mode }, 25, ReceivePosition); } if (started_) { if (checkBoxSetNextPos.Checked && tmoSendPos_.CheckExpired() && mode_ != PWM_ALT && mode_ != PWM_AZM) { Int32 elapsed = (Int32)(DateTime.Now - startDT_).TotalMilliseconds; Int32 ts = startTs_ + elapsed + 10000; double sp = startAltPos_ + speed_ * (elapsed + 10000) / (24.0 * 60.0 * 60000.0); SendSetNextPosCommand((float)sp, ts, mode_, ReceiveSetNextPos); } #if LOGGING_ON if (connection_ != null && checkBoxLogging.Checked && tmoAddLogData_.CheckExpired()) { int logCnt = logNextBlockSize_ + 5; if (logCnt > 14) { logCnt = 14; } SendCommand(connection_, new byte[] { (byte)'L', (byte)'w', (byte)logCnt, 0 }, 4 + logCnt * 4, AddLogData); } #endif } }