示例#1
0
//==============================================================================
uint16 ICACHE_FLASH_ATTR getSetTemperature()
{
	 
  unsigned int aTime = date_time.TIME.hour * 60 + date_time.TIME.min;

  int aDayNumber = getDayOfWeek();

  unsigned char aDay;
  u_CONFIG *aPtr;
  unsigned long col;
  
  if      (aDayNumber == 0)  aDay = configs.nastr.day[5];
  else if (aDayNumber == 1)  aDay = configs.nastr.day[6]; 
  else                       aDay = configs.nastr.day[aDayNumber - 2]; 
  
  u_CONFIG_u cPtr;// = (aDay == 'H') ? configs.cfg[1] : configs.cfg[0];

  if(aDay == 'H'){ cPtr = configs.cfg[1]; print_icon(8, 8, 0xff7f7f, 0x5f, 4);}
  else           { cPtr = configs.cfg[0]; print_icon(8, 8, 0x7f00, 0x5f, 5);}

  cPtr = (aDay == 'H') ? configs.cfg[1] : configs.cfg[0];
      
  uint32 curPeriod = 0;

  for(curPeriod = 0; curPeriod < (cPtr.periodsCnt - 1); curPeriod++)
  {
	//uint32 a = cPtr.pConfig[curPeriod + 1].hmStart;
	unsigned int end = cPtr.pConfig[curPeriod + 1].hStart * 60 + cPtr.pConfig[curPeriod + 1].mStart;;
//			(((a>>24) - '0') * 10 +   (((a>>16) & 0x00000ff) - '0')) * 60 +
//                       ((((a>>8) & 0x00000ff) - '0') * 10 +   ((a & 0x00000ff) - '0'));
    if(aTime < end)  break;     
  }

  // set temperature
  char_6x8(36 + 28 , 12 , GREEN, 0x5f, (char)(cPtr.pConfig[curPeriod].temperature / 100) + '0');
  char_6x8(48 + 28 , 12 , GREEN, 0x5f, (char)((cPtr.pConfig[curPeriod].temperature % 100) /10) + '0');
  char_6x8(60 + 28 , 12 , GREEN, 0x5f, ',');
  char_6x8(72 + 28 , 12 , GREEN, 0x5f, (char)(cPtr.pConfig[curPeriod].temperature % 10) + '0');

  // delta
  char_6x8(96 + 28 , 12 , 0x7f00, 0x5f, 0x7e);
  char_6x8(108 + 28 , 12 , 0x7f00, 0x5f, configs.nastr.delta/10 + '0');
  char_6x8(120 + 28 , 12 , 0x7f00, 0x5f, ',');
  char_6x8(132 + 28 , 12 , 0x7f00, 0x5f, configs.nastr.delta%10 + '0');


  return cPtr.pConfig[curPeriod].temperature;
}
示例#2
0
//==============================================================================
unsigned char ICACHE_FLASH_ATTR cmpTemperature (uint16 aT, signed int arcTemper)
{  
  static unsigned char out = 0;

  ///int tmp = (aT[2] - '0') * 100 + (aT[1] - '0') * 10 + (aT[0] - '0');
  
  if      (arcTemper > aT + (configs.nastr.delta))
  {
	print_icon(34, 8, GREEN, 0x5f, 1);
    out = 0; 
  }
  else if (arcTemper < aT - (configs.nastr.delta))
  {
	  print_icon(34, 8, RED, 0x5f, 0);
    out = 1;
  }
  

 return out; 
}
static int lex_log_token(int token)
{
    if( lexdebug ) {
  fprintf(stderr, "Lexer: line %d, token %s",
    yylineno, lex_token_to_string(token));
  if( token == T_ICON ) {
      fprintf(stderr, ", value ");
      print_icon(stderr, yylval.voidp);
  } else if( token == T_RCON ) {
      fprintf(stderr, ", value ");
    print_rcon(stderr, yylval.voidp);
  } else if( token == T_IDENT ) {
      fprintf(stderr, ", value \"");
      print_scon(stderr, yylval.voidp);
      fputc('"', stderr);
  }
  fputc('\n', stderr);
    }
    return token;
}