Beispiel #1
0
static void tone_doWork(void)
{
#ifdef PIEZO_HZ
  if (tone_idx == 0xff)
    return;
  unsigned int elapsed = millis() - tone_last;
  unsigned int dur = pgm_read_byte(&tone_durs[tone_idx]) * 10;
  if (elapsed > dur)
  {
    tone_last = millis();
    tone_idx = (tone_idx + 1) % tone_cnt;
    if (tone_idx % 2 == 0)
    {
      dur = pgm_read_byte(&tone_durs[tone_idx]) * 10;
      tone4khz_begin(PIN_ALARM, dur);
      setLcdBacklight(0x80 | 0);
    }
    else
      setLcdBacklight(0x80 | g_LcdBacklight);
  }
#endif /* PIEZO_HZ */
}
Beispiel #2
0
static void toneEnable(boolean enable)
{
#ifdef PIEZO_HZ
  if (enable)
  {
    if (tone_idx != 0xff)
      return;
    tone_last = 0;
    tone_idx = tone_cnt - 1;
  }
  else
  {
    tone_idx = 0xff;
    tone4khz_end();
    setLcdBacklight(g_LcdBacklight);
  }
#endif /* PIEZO_HZ */
}
Beispiel #3
0
static state_t menuLcdBacklight(button_t button)
{
  if (button == BUTTON_ENTER)
  {
    lcdprint_P(PSTR("LCD brightness"), true);
    editInt = g_LcdBacklight;
  }
  else if (button == BUTTON_LEAVE)
  {
    if (editInt != g_LcdBacklight)
    {
      storeLcdBacklight(editInt);
      reportLcdParameters();
    }
  }
  
  menuNumberEdit(button, 10, 0, 100, PSTR("%3d%%"));
  setLcdBacklight(0x80 | editInt);
  return ST_AUTO;
}
Beispiel #4
0
static void eepromLoadBaseConfig(unsigned char forceDefault)
{
  // The compiler likes to join eepromLoadBaseConfig and eepromLoadProbeConfig s
  // this union saves stack space by reusing the same memory area for both structs
  union {
    struct __eeprom_data base;
    struct __eeprom_probe probe;
  } config;

  econfig_read_block(&config.base, 0, sizeof(__eeprom_data));
  forceDefault = forceDefault || config.base.magic != EEPROM_MAGIC;
  if (forceDefault != 0)
  {
    memcpy_P(&config.base, &DEFAULT_CONFIG[forceDefault - 1], sizeof(__eeprom_data));
    econfig_write_block(&config.base, 0, sizeof(__eeprom_data));
  }
  
  pid.setSetPoint(config.base.setPoint);
  pid.LidOpenOffset = config.base.lidOpenOffset;
  pid.setLidOpenDuration(config.base.lidOpenDuration);
  memcpy(pid.Pid, config.base.pidConstants, sizeof(config.base.pidConstants));
  if (config.base.manualMode)
    pid.setPidOutput(0);
  setLcdBacklight(config.base.lcdBacklight);
#ifdef HEATERMETER_RFM12
  memcpy(rfMap, config.base.rfMap, sizeof(rfMap));
#endif
  pid.setUnits(config.base.pidUnits == 'C' ? 'C' : 'F');
  pid.setFanMinSpeed(config.base.fanMinSpeed);
  pid.setFanMaxSpeed(config.base.fanMaxSpeed);
  pid.setFanActiveFloor(config.base.fanActiveFloor);
  pid.setFanMaxStartupSpeed(config.base.fanMaxStartupSpeed);
  pid.setOutputFlags(config.base.pidOutputFlags);
  g_HomeDisplayMode = config.base.homeDisplayMode;
  pid.setServoMinPos(config.base.servoMinPos);
  pid.setServoMaxPos(config.base.servoMaxPos);
  pid.setServoActiveCeil(config.base.servoActiveCeil);

  for (unsigned char led = 0; led<LED_COUNT; ++led)
    ledmanager.setAssignment(led, config.base.ledConf[led]);
}
Beispiel #5
0
void storeLcdBacklight(unsigned char lcdBacklight)
{
  lcdBacklight = constrain(lcdBacklight, 0, 100);
  setLcdBacklight(lcdBacklight);
  config_store_byte(lcdBacklight, lcdBacklight);
}