示例#1
0
u16 MATCH(u16 measured, u16 desired) {
  SerialPrint(UART,"Testing: ");
  SerialPrint(UART,TICKS_LOW(desired), DEC);
  SerialPrint(UART," <= ");
  SerialPrint(UART,measured, DEC);
  SerialPrint(UART," <= ");
  SerialPrintln(TICKS_HIGH(desired), DEC);
  return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}
示例#2
0
文件: IRremoteSF.cpp 项目: Eih3/v0.83
int MATCH(int measured, int desired) {
  Serial.print("Testing: ");
  Serial.print(TICKS_LOW(desired), DEC);
  Serial.print(" <= ");
  Serial.print(measured, DEC);
  Serial.print(" <= ");
  Serial.println(TICKS_HIGH(desired), DEC);
  return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}
示例#3
0
//+=============================================================================
// The match functions were (apparently) originally MACROs to improve code speed
//   (although this would have bloated the code) hence the names being CAPS
// A later release implemented debug output and so they needed to be converted
//   to functions.
// I tried to implement a dual-compile mode (DEBUG/non-DEBUG) but for some
//   reason, no matter what I did I could not get them to function as macros again.
// I have found a *lot* of bugs in the Arduino compiler over the last few weeks,
//   and I am currently assuming that one of these bugs is my problem.
// I may revisit this code at a later date and look at the assembler produced
//   in a hope of finding out what is going on, but for now they will remain as
//   functions even in non-DEBUG mode
//
int  MATCH (int measured,  int desired)
{
 	DBG_PRINT("Testing: ");
 	DBG_PRINT(TICKS_LOW(desired), DEC);
 	DBG_PRINT(" <= ");
 	DBG_PRINT(measured, DEC);
 	DBG_PRINT(" <= ");
 	DBG_PRINTLN(TICKS_HIGH(desired), DEC);

 	return ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
}
示例#4
0
文件: IRremoteSF.cpp 项目: Eih3/v0.83
int MATCH_SPACE(int measured_ticks, int desired_us) {
  Serial.print("Testing space ");
  Serial.print(measured_ticks * USECPERTICK, DEC);
  Serial.print(" vs ");
  Serial.print(desired_us, DEC);
  Serial.print(": ");
  Serial.print(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
  Serial.print(" <= ");
  Serial.print(measured_ticks, DEC);
  Serial.print(" <= ");
  Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
  return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
}
示例#5
0
u16 MATCH_SPACE(u16 measured_ticks, u16 desired_us) {
  SerialPrint(UART,"Testing space ");
  SerialPrint(UART,measured_ticks * USECPERTICK, DEC);
  SerialPrint(UART," vs ");
  SerialPrint(UART,desired_us, DEC);
  SerialPrint(UART,": ");
  SerialPrint(UART,TICKS_LOW(desired_us - MARK_EXCESS), DEC);
  SerialPrint(UART," <= ");
  SerialPrint(UART,measured_ticks, DEC);
  SerialPrint(UART," <= ");
  SerialPrintln(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
  return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
}
示例#6
0
int MATCH_SPACE(int measured_ticks, int desired_us) {
  #ifdef DEBUG
  Serial.print("Testing space ");
  Serial.print(measured_ticks * USECPERTICK, DEC);
  Serial.print(" vs ");
  Serial.print(desired_us, DEC);
  Serial.print(": ");
  Serial.print(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
  Serial.print(" <= ");
  Serial.print(measured_ticks, DEC);
  Serial.print(" <= ");
  Serial.println(TICKS_HIGH(desired_us + MARK_EXCESS), DEC); // SH 071112 - -> +
  #endif
  return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS); // SH 071112 - -> + in TICKS_HIGH
}
示例#7
0
//+========================================================
// Due to sensor lag, when received, Spaces tend to be 100us too short
//
int  MATCH_SPACE (int measured_ticks,  int desired_us)
{
	DBG_PRINT("Testing space ");
	DBG_PRINT(measured_ticks * USECPERTICK, DEC);
	DBG_PRINT(" vs ");
	DBG_PRINT(desired_us, DEC);
	DBG_PRINT(": ");
	DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
	DBG_PRINT(" <= ");
	DBG_PRINT(measured_ticks, DEC);
	DBG_PRINT(" <= ");
	DBG_PRINTLN(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);

	return ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
	     && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
}
示例#8
0
//+=============================================================================
// The match functions were (apparently) originally MACROs to improve code speed
//   (although this would have bloated the code) hence the names being CAPS
// A later release implemented debug output and so they needed to be converted
//   to functions.
// I tried to implement a dual-compile mode (DEBUG/non-DEBUG) but for some
//   reason, no matter what I did I could not get them to function as macros again.
// I have found a *lot* of bugs in the Arduino compiler over the last few weeks,
//   and I am currently assuming that one of these bugs is my problem.
// I may revisit this code at a later date and look at the assembler produced
//   in a hope of finding out what is going on, but for now they will remain as
//   functions even in non-DEBUG mode
//
int  MATCH (int measured,  int desired)
{
 	DBG_PRINT(F("Testing: "));
 	DBG_PRINT(TICKS_LOW(desired), DEC);
 	DBG_PRINT(F(" <= "));
 	DBG_PRINT(measured, DEC);
 	DBG_PRINT(F(" <= "));
 	DBG_PRINT(TICKS_HIGH(desired), DEC);

  bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
  if (passed)
    DBG_PRINTLN(F("?; passed"));
  else
    DBG_PRINTLN(F("?; FAILED"));
 	return passed;
}
示例#9
0
//+========================================================
// Due to sensor lag, when received, Spaces tend to be 100us too short
//
int  MATCH_SPACE (int measured_ticks,  int desired_us)
{
	DBG_PRINT(F("Testing space (actual vs desired): "));
	DBG_PRINT(measured_ticks * USECPERTICK, DEC);
	DBG_PRINT(F("us vs "));
	DBG_PRINT(desired_us, DEC);
	DBG_PRINT("us");
	DBG_PRINT(": ");
	DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS) * USECPERTICK, DEC);
	DBG_PRINT(F(" <= "));
	DBG_PRINT(measured_ticks * USECPERTICK, DEC);
	DBG_PRINT(F(" <= "));
	DBG_PRINT(TICKS_HIGH(desired_us - MARK_EXCESS) * USECPERTICK, DEC);

  bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
                && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
  if (passed)
    DBG_PRINTLN(F("?; passed"));
  else
    DBG_PRINTLN(F("?; FAILED"));
 	return passed;
}
示例#10
0
文件: IRremoteSF.cpp 项目: Eih3/v0.83
int MATCH(int measured, int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);}
示例#11
0
uint8_t MATCH(const uint16_t measured, const uint16_t desired)
{
    return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}