public string GetButtons(Sensors rsSensorPoll) { string value = null; if (rsSensorPoll.Packet.Buttons.Clean) { value += " Clean"; } if (rsSensorPoll.Packet.Buttons.Max) { value += " Max"; } if (rsSensorPoll.Packet.Buttons.Home) { value += " Home"; } if (rsSensorPoll.Packet.Buttons.Power) { value += " Power"; } if (rsSensorPoll.Packet.Buttons.Spot) { value += " Spot"; } return value; }
public string GetOverCurrents(Sensors rsSensorPoll) { string value = null; if (rsSensorPoll.Packet.OverCurrent.Left_Wheel) { value += " Left Wheel"; } if (rsSensorPoll.Packet.OverCurrent.Right_Wheel) { value += " Right Wheel"; } if (rsSensorPoll.Packet.OverCurrent.Side_Brush) { value += " Side Brush"; } if (rsSensorPoll.Packet.OverCurrent.Main_Brush) { value += " Main Brush"; } if (rsSensorPoll.Packet.OverCurrent.Vacuum) { value += " Vacuum"; } return value; }
public void ShowSyncBytes(Sensors rsCurrentSensorPoll) { if (this.chkShowSyncBytes.Checked) { try { this.lblSync0.Text = rsCurrentSensorPoll.Sync_Bytes[0].ToString(); this.lblSync1.Text = rsCurrentSensorPoll.Sync_Bytes[1].ToString(); this.lblSync2.Text = rsCurrentSensorPoll.Sync_Bytes[2].ToString(); this.lblSync3.Text = rsCurrentSensorPoll.Sync_Bytes[3].ToString(); this.lblSync4.Text = rsCurrentSensorPoll.Sync_Bytes[4].ToString(); this.lblSync5.Text = rsCurrentSensorPoll.Sync_Bytes[5].ToString(); this.lblSync6.Text = rsCurrentSensorPoll.Sync_Bytes[6].ToString(); this.lblSync7.Text = rsCurrentSensorPoll.Sync_Bytes[7].ToString(); this.lblSync8.Text = rsCurrentSensorPoll.Sync_Bytes[8].ToString(); this.lblSync9.Text = rsCurrentSensorPoll.Sync_Bytes[9].ToString(); this.lblSync10.Text = rsCurrentSensorPoll.Sync_Bytes[10].ToString(); this.lblSync11.Text = rsCurrentSensorPoll.Sync_Bytes[11].ToString(); this.lblSync12.Text = rsCurrentSensorPoll.Sync_Bytes[12].ToString(); this.lblSync13.Text = rsCurrentSensorPoll.Sync_Bytes[13].ToString(); this.lblSync14.Text = rsCurrentSensorPoll.Sync_Bytes[14].ToString(); this.lblSync15.Text = rsCurrentSensorPoll.Sync_Bytes[15].ToString(); this.lblSync16.Text = rsCurrentSensorPoll.Sync_Bytes[16].ToString(); this.lblSync17.Text = rsCurrentSensorPoll.Sync_Bytes[17].ToString(); this.lblSync18.Text = rsCurrentSensorPoll.Sync_Bytes[18].ToString(); this.lblSync19.Text = rsCurrentSensorPoll.Sync_Bytes[19].ToString(); this.lblSync20.Text = rsCurrentSensorPoll.Sync_Bytes[20].ToString(); this.lblSync21.Text = rsCurrentSensorPoll.Sync_Bytes[21].ToString(); this.lblSync22.Text = rsCurrentSensorPoll.Sync_Bytes[22].ToString(); this.lblSync23.Text = rsCurrentSensorPoll.Sync_Bytes[23].ToString(); this.lblSync24.Text = rsCurrentSensorPoll.Sync_Bytes[24].ToString(); this.lblSync25.Text = rsCurrentSensorPoll.Sync_Bytes[25].ToString(); } catch { } } }
public string GetBumpsWheelDrops(Sensors rsSensorPoll) { string value = null; if (rsSensorPoll.Packet.Bump.Left) { value += " B. Left"; } if (rsSensorPoll.Packet.Bump.Right) { value += " B. Right"; } if (rsSensorPoll.Packet.WheelDrop.Left) { value += " WD Left"; } if (rsSensorPoll.Packet.WheelDrop.Right) { value += " WD Right"; } if (rsSensorPoll.Packet.WheelDrop.Caster) { value += " WD Caster"; } return value; }
private void Check_If_Plugged_In(Sensors rsCurrentSensorPoll) { //Check sensors to see if current is negative. //If it is, then disable the motor buttons & flash "Plugged In" in Bold Red in time with the sensor polls. //If Roomba is charging, then flash that in Red as well, in time with the sensor polls. //Program.UI.Started = false; byte chargeState = rsCurrentSensorPoll.Packet.Charging_State; this.PopulateChargeState(chargeState, rsCurrentSensorPoll); Log.This(c_sChargeState + this.lblChargeState.Text + c_sVoltage + rsCurrentSensorPoll.Packet.Voltage.ToString() + c_sCurrent + rsCurrentSensorPoll.Packet.Current.ToString(), this.Name, Program.UI.Config.Log.StartForm_Charging); }
public void ShowRawBytes(Sensors rsCurrentSensorPoll) { if (rsCurrentSensorPoll.IsCurrent || this.chkIgnore_IsCurrent.Checked) { if (this.chkShowRawBytes.Checked) { try { if (rsCurrentSensorPoll.Raw_Bytes != null) { this.lblRaw0.Text = rsCurrentSensorPoll.Raw_Bytes[0].ToString(); this.lblRaw1.Text = rsCurrentSensorPoll.Raw_Bytes[1].ToString(); this.lblRaw2.Text = rsCurrentSensorPoll.Raw_Bytes[2].ToString(); this.lblRaw3.Text = rsCurrentSensorPoll.Raw_Bytes[3].ToString(); this.lblRaw4.Text = rsCurrentSensorPoll.Raw_Bytes[4].ToString(); this.lblRaw5.Text = rsCurrentSensorPoll.Raw_Bytes[5].ToString(); this.lblRaw6.Text = rsCurrentSensorPoll.Raw_Bytes[6].ToString(); this.lblRaw7.Text = rsCurrentSensorPoll.Raw_Bytes[7].ToString(); this.lblRaw8.Text = rsCurrentSensorPoll.Raw_Bytes[8].ToString(); this.lblRaw9.Text = rsCurrentSensorPoll.Raw_Bytes[9].ToString(); this.lblRaw10.Text = rsCurrentSensorPoll.Raw_Bytes[10].ToString(); this.lblRaw11.Text = rsCurrentSensorPoll.Raw_Bytes[11].ToString(); this.lblRaw12.Text = rsCurrentSensorPoll.Raw_Bytes[12].ToString(); this.lblRaw13.Text = rsCurrentSensorPoll.Raw_Bytes[13].ToString(); this.lblRaw14.Text = rsCurrentSensorPoll.Raw_Bytes[14].ToString(); this.lblRaw15.Text = rsCurrentSensorPoll.Raw_Bytes[15].ToString(); this.lblRaw16.Text = rsCurrentSensorPoll.Raw_Bytes[16].ToString(); this.lblRaw17.Text = rsCurrentSensorPoll.Raw_Bytes[17].ToString(); this.lblRaw18.Text = rsCurrentSensorPoll.Raw_Bytes[18].ToString(); this.lblRaw19.Text = rsCurrentSensorPoll.Raw_Bytes[19].ToString(); this.lblRaw20.Text = rsCurrentSensorPoll.Raw_Bytes[20].ToString(); this.lblRaw21.Text = rsCurrentSensorPoll.Raw_Bytes[21].ToString(); this.lblRaw22.Text = rsCurrentSensorPoll.Raw_Bytes[22].ToString(); this.lblRaw23.Text = rsCurrentSensorPoll.Raw_Bytes[23].ToString(); this.lblRaw24.Text = rsCurrentSensorPoll.Raw_Bytes[24].ToString(); this.lblRaw25.Text = rsCurrentSensorPoll.Raw_Bytes[25].ToString(); lblError.Text = null; } else { lblError.Text = "No Data"; } } catch (Exception ex) { lblError.Text = ex.Message; } } } else { lblError.Text = "No Data"; } }
public void PopulateChargeState(byte byChargingState, Sensors rsCurrentSensorPoll) { bool bPluggedIn = false; Application.DoEvents(); if (byChargingState == Charging_State.Not_Charging) { this.lblChargeState.Text = Charge_State_Description.Not_Charging; bPluggedIn = false; } else if (byChargingState == Charging_State.Charging_Recovery) { this.lblChargeState.Text = Charge_State_Description.Charging_Recovery; bPluggedIn = true; } else if (byChargingState == Charging_State.Charging) { //After you unplug Roomba, Roomba's OS still thinks it is charging, so you will continue to get this indicator. //The best thing to do to reset things os to start & stop Roomba this.lblChargeState.Text = Charge_State_Description.Charging; bPluggedIn = true; } else if (byChargingState == Charging_State.Trickle_Charging) { this.lblChargeState.Text = Charge_State_Description.Trickle_Charging; bPluggedIn = true; } else if (byChargingState == Charging_State.Waiting) { this.lblChargeState.Text = Charge_State_Description.Waiting; bPluggedIn = true; } else if (byChargingState == Charging_State.Charging_Error) { this.lblChargeState.Text = Charge_State_Description.Charging_Error; bPluggedIn = true; } else { this.lblChargeState.Text = "Error"; bPluggedIn = false; } this.PluggedIn(bPluggedIn); if (rsCurrentSensorPoll.Packet.Current < 0) { this.lblChargeState.Text = Charge_State_Description.Plugged_In; this.PluggedIn(true, true); } }
private void SetIsCurrentConnected(Sensors snRoomba) { this.toolTip1.SetToolTip(lblIsCurrent, null); this.lblIsCurrent.Text = snRoomba.ParseTime.Ticks.ToString(); if (Program.UI.CurrentRoomba.New_State) { this.lblIsCurrent.BackColor = Color.Green; } else { this.lblIsCurrent.BackColor = Color.LightGreen; } this.toolTip1.SetToolTip(lblIsCurrent, snRoomba.LastUpdated.ToString()); this.lblLastCurrent.Text = snRoomba.LastUpdated.ToString(); }
//Populates all sensor indicators on the form from Roomba's Sensor structure private void Show_SensorData(Sensors rsCurrentSensorPoll) { try { Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Power, this.pPower); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Spot, this.pSpot); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Clean, this.pClean); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Max, this.pMax); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Home, this.pHome); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Cliff.Left, this.pCliffLeft); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Cliff.Right, this.pCliffRight); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Cliff.FrontLeft, this.pCliffFrontLeft); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Cliff.FrontRight, this.pCliffFrontRight); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Bump.Left, this.pBump_Left); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Bump.Right, this.pBump_Right); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.WheelDrop.Left, this.pWheelDrop_Left); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.WheelDrop.Right, this.pWheelDrop_Right); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.WheelDrop.Caster, this.pWheelDrop_Caster); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.OverCurrent.Left_Wheel, this.pDriveLeft_Overcurrent); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.OverCurrent.Right_Wheel, this.pDriveRight_OverCurrent); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.OverCurrent.Main_Brush, this.pMainBrush_Overcurrent); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.OverCurrent.Side_Brush, this.pSideBrush_Overcurrent); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.OverCurrent.Vacuum, this.pVacuum_OverCurrent); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Virtual_Wall, this.pVirtual_Wall); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Wall, this.pWallDetect); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Power, this.pPower); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Spot, this.pSpot); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Clean, this.pClean); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Max, this.pMax); Program.UI.SetPictureBox(rsCurrentSensorPoll.Packet.Buttons.Home, this.pHome); } catch (Exception ex) { this.lblError.Text = ex.Message; //Log.This(ex.Message + " " + MethodBase.GetCurrentMethod().ToString()); } }
public void EnforceSafeMode(Sensors rsCurrentSensorPoll) { if ((rsCurrentSensorPoll.Packet.WheelDrop.Left || rsCurrentSensorPoll.Packet.WheelDrop.Caster || rsCurrentSensorPoll.Packet.WheelDrop.Right || rsCurrentSensorPoll.Packet.Cliff.Left || rsCurrentSensorPoll.Packet.Cliff.FrontLeft || rsCurrentSensorPoll.Packet.Cliff.FrontRight || rsCurrentSensorPoll.Packet.Cliff.Right) && (!(this.Current_Mode == SCI_Mode.Full))) { this.SetMode(SCI_Mode.Passive); } }
public void Check_Battery(Sensors sSensorPollToCheck) { //Changes a property on this form if things get too bad //rsCurrentSensorPoll.Packet.Voltage.ToString(); //rsCurrentSensorPoll.Packet.Current.ToString(); //rsCurrentSensorPoll.Packet.Temperature.ToString(); //Convert.ToString(Convert.ToInt32(this.lblTemp.Text) * 9 / 5 + 32); //rsCurrentSensorPoll.Packet.Charge.ToString(); //rsCurrentSensorPoll.Packet.Capacity.ToString(); }