Esempio n. 1
0
static void storeRfMap(unsigned char probeIndex, unsigned char source)
{
  rfMap[probeIndex] = source;

  unsigned char *ofs = (unsigned char *)offsetof(__eeprom_data, rfMap);
  ofs += probeIndex;
  econfig_write_byte(ofs, source);

  reportRfMap();
  checkInitRfManager();
}
Esempio 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);
}