private void Check_If_Plugged_In(RoombaSCI.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. byte chargeState = rsCurrentSensorPoll.Packet.Charging_State; this.PopulateChargeState(chargeState); }
public void Display_SensorInfo2(RoombaSCI.Sensors rsCurrentSensorPoll) { try { this.lblBytesRCVD.Text = rsCurrentSensorPoll.Raw_Bytes.Count.ToString() + c_sBytesRCVD; this.lblBumps_WheelDropsRaw.Text = rsCurrentSensorPoll.Sync_Bytes[0].ToString(); this.lblBumps_WheelDrops.Text = this.GetBumpsWheelDrops(rsCurrentSensorPoll); this.lblWall.Text = rsCurrentSensorPoll.Packet.Wall.ToString(); this.lblCliff_Left.Text = rsCurrentSensorPoll.Packet.Cliff.Left.ToString(); this.lblCliff_Front_Left.Text = rsCurrentSensorPoll.Packet.Cliff.FrontLeft.ToString(); this.lblCliff_Front_Right.Text = rsCurrentSensorPoll.Packet.Cliff.FrontRight.ToString(); this.lblCliff_Right.Text = rsCurrentSensorPoll.Packet.Cliff.Right.ToString(); this.lblVirtual_Wall.Text = rsCurrentSensorPoll.Packet.Virtual_Wall.ToString(); this.lblDirt_Detector_Left.Text = rsCurrentSensorPoll.Packet.Dirt_Detector.Left.ToString(); this.lblDirt_Detector_Right.Text = rsCurrentSensorPoll.Packet.Dirt_Detector.Right.ToString(); this.lblButtonsRaw.Text = rsCurrentSensorPoll.Sync_Bytes[11].ToString(); this.lblButtons.Text = this.GetButtons(rsCurrentSensorPoll); this.lblRemote.Text = rsCurrentSensorPoll.Packet.Remote_Control_Command.ToString(); this.lblDistance_Traveled.Text = rsCurrentSensorPoll.Packet.Distance.ToString(); this.lblAngle_Traveled.Text = rsCurrentSensorPoll.Packet.Angle.ToString(); this.lblChargeStateRaw.Text = rsCurrentSensorPoll.Sync_Bytes[16].ToString(); this.PopulateChargeState(rsCurrentSensorPoll.Packet.Charging_State); this.lblVoltage.Text = rsCurrentSensorPoll.Packet.Voltage.ToString(); this.lblCurrent.Text = rsCurrentSensorPoll.Packet.Current.ToString(); this.lblTemp.Text = rsCurrentSensorPoll.Packet.Temperature.ToString(); this.lblTempF.Text = Convert.ToString(Convert.ToInt32(this.lblTemp.Text) * 9 / 5 + 32); this.lblCharge.Text = rsCurrentSensorPoll.Packet.Charge.ToString(); this.lblCapacity.Text = rsCurrentSensorPoll.Packet.Capacity.ToString(); this.lblMotorOvercurrentsRaw.Text = rsCurrentSensorPoll.Sync_Bytes[7].ToString(); this.lblMotorOvercurrents.Text = this.GetOverCurrents(rsCurrentSensorPoll); } catch { } }
//Move this to Sensors Object.. public Hashtable ExportSensors(RoombaSCI.Sensor_Packet sensors) { Hashtable hLookup = new Hashtable(); hLookup.Add(c_sAngle, sensors.Angle); hLookup.Add(c_sBumpRight, sensors.Bump.Right); hLookup.Add(c_sBumpLeft, sensors.Bump.Left); hLookup.Add(c_sClean, sensors.Buttons.Clean); hLookup.Add(c_sMax, sensors.Buttons.Max); hLookup.Add(c_sMax, sensors.Buttons.Home); hLookup.Add(c_sPower, sensors.Buttons.Power); hLookup.Add(c_sSpot, sensors.Buttons.Spot); hLookup.Add(c_sCapacity, sensors.Capacity); hLookup.Add(c_sCharge, sensors.Charge); hLookup.Add(c_sChargingState, sensors.Charging_State); hLookup.Add(c_sCliffFrontLeft, sensors.Cliff.FrontLeft); hLookup.Add(c_sCliffFrontRight, sensors.Cliff.FrontRight); hLookup.Add(c_sCliffLeft, sensors.Cliff.Left); hLookup.Add(c_sCliffRight, sensors.Cliff.Right); hLookup.Add(c_sCurrent, sensors.Current); hLookup.Add(c_sDirtDetectorLeft, sensors.Dirt_Detector.Left); hLookup.Add(c_sDirtDetectorRight, sensors.Dirt_Detector.Right); hLookup.Add(c_sDistance, sensors.Distance); hLookup.Add(c_sOverCurrentLeft, sensors.OverCurrent.Left_Wheel); hLookup.Add(c_sOverCurrentRight, sensors.OverCurrent.Right_Wheel); hLookup.Add(c_sOverCurrentMAIN, sensors.OverCurrent.Main_Brush); hLookup.Add(c_sOverCurrentSide, sensors.OverCurrent.Side_Brush); hLookup.Add(c_sOverCurrentVacuum, sensors.OverCurrent.Vacuum); hLookup.Add(c_sRemote, sensors.Remote_Control_Command); hLookup.Add(c_sTemperature, sensors.Temperature); hLookup.Add(c_sVirtualWall, sensors.Virtual_Wall); hLookup.Add(c_sVoltage, sensors.Voltage); hLookup.Add(c_sWall, sensors.Wall); hLookup.Add(c_sWheelDropCaster, sensors.WheelDrop.Caster); hLookup.Add(c_sWheelDropLeft, sensors.WheelDrop.Left); hLookup.Add(c_sWheelDropNone, sensors.WheelDrop.None); hLookup.Add(c_sWheelDropRight, sensors.WheelDrop.Right); //This is how you look up.. //string x = hLookup["Angle"].ToString(); return hLookup; }