public double getTemperature(double calibration) { try { double tempSample = IOIOHelper.getCurrent().getTemperature(); if (tempSample != -99) { tempSample += calibration; temps[tempIndex] = tempSample; if (tempSamples < tempMaxSamples) tempSamples++; tempIndex++; if (tempIndex >= tempMaxSamples) tempIndex = 0; } } catch (Exception e) { Utils.logError(e.toString(), "utils.FurnaceController.getTemperature"); } double result = 0; if (tempSamples > 0) { double totalTemp = 0; for (int i = 0; i < tempSamples; i++) { totalTemp += temps[i]; } result = (double) Math.round(totalTemp / (double) tempSamples * 10) / 10; } return result; // return IOIOHelper.getCurrent().getTemperature(); }
public void toggleHeat(boolean on) { if (this.heatOn != on) { if (!on && heatOn) this.lastHeatTime = Calendar.getInstance(); this.heatOn = on; IOIOHelper.getCurrent().toggleHeat(on); } }
public void toggleCool(boolean on) { if (this.coolOn != on) { if (!on && coolOn) this.lastCoolTime = Calendar.getInstance(); this.coolOn = on; IOIOHelper.getCurrent().toggleCool(on); } }
private void toggleFan(boolean on) { if (this.fanOn != on) { if (!on && fanOn) this.offTime = Calendar.getInstance(); this.fanOn = on; IOIOHelper.getCurrent().toggleFan(on); } }