Exemplo n.º 1
0
static state_t menuResetConfig(button_t button)
{
    if (button == BUTTON_ENTER)
    {
        lcdprint_P(PSTR("Reset config?"), true);
        editInt = 0;
    }
    else if (button == BUTTON_LEAVE)
    {
        if (editInt != 0)
            eepromLoadConfig(1);
    }
    menuBooleanEdit(button, NULL);
    return ST_AUTO;
}
Exemplo n.º 2
0
void hmcoreSetup(void)
{
  pinMode(PIN_WIRELESS_LED, OUTPUT);
  blinkLed();
  
#ifdef HEATERMETER_SERIAL
  Serial.begin(HEATERMETER_SERIAL);
  // don't use SerialX because we don't want any preamble
  Serial.write('\n');
  reportVersion();
#endif  /* HEATERMETER_SERIAL */
#ifdef USE_EXTERNAL_VREF  
  analogReference(EXTERNAL);
#endif  /* USE_EXTERNAL_VREF */
  // Disable Analog Comparator
  ACSR = bit(ACD);
  // Disable Digital Input on ADC pins
  DIDR0 = bit(ADC5D) | bit(ADC4D) | bit(ADC3D) | bit(ADC2D) | bit(ADC1D) | bit(ADC0D);
  // And other unused units
  power_twi_disable();

  // Switch the pin mode first to INPUT with internal pullup
  // to take it to 5V before setting the mode to OUTPUT. 
  // If we reverse this, the pin will go OUTPUT,LOW and reboot.
  // SoftReset and WiShield are mutually exlusive, but it is HIGH/OUTPUT too
  digitalWrite(PIN_SOFTRESET, HIGH);
  pinMode(PIN_SOFTRESET, OUTPUT);
  
  pinMode(PIN_ALARM, OUTPUT);

  pid.Probes[TEMP_PIT] = &probe0;
  pid.Probes[TEMP_FOOD1] = &probe1;
  pid.Probes[TEMP_FOOD2] = &probe2;
  pid.Probes[TEMP_AMB] = &probe3;
  pid.init();

  eepromLoadConfig(0);
  lcdDefineChars();
#ifdef HEATERMETER_RFM12
  checkInitRfManager();
#endif

  Menus.setState(ST_HOME_NOPROBES);
}