Ejemplo n.º 1
0
uint8_t Radio::getState()
{
  uint16_t rawValue = getRawValue();
  if (rawValue < RADIO_MID_THRESHOLD_LOW) return RADIO_SWITCH_OFF;
  if (rawValue > RADIO_MID_THRESHOLD_HIGH) return RADIO_SWITCH_ON;
  return RADIO_SWITCH_MID;
}
Ejemplo n.º 2
0
void
RemapImage::mousePressEvent(QMouseEvent *event)
{
  //QPoint pp = mapFromParent(event->pos());
  QPoint pp = event->pos();
  float ypos = pp.y();
  float xpos = pp.x();

  m_button = event->button();

  m_cursorPos = pp;
  m_pickPoint = false;

  if (m_button == Qt::LeftButton)
    {
      bool shiftModifier = event->modifiers() & Qt::ShiftModifier;
      if (checkRubberBand(xpos, ypos, shiftModifier))
	return;
    }
  else if (m_button == Qt::RightButton)
    {
      if (validPickPoint(xpos,  ypos))
	emit getRawValue(m_pickDepth,
			 m_pickWidth,
			 m_pickHeight);

    }

  update();
}
Ejemplo n.º 3
0
void Sensor::printValues(void) {
	Serial.print(F("Sensor: "));
	if (getName().length() > 0) {
		Serial.print(getName());
	}
	Serial.println("");
	for (int i = 0; i < getSensorValueCount(); i++) {
		if (value[i].enabled) {
			Serial.print(F("   Val["));
			Serial.print(i);
			Serial.print(F(","));
			Serial.print(value[i].vname);
			Serial.print(F("]="));
			Serial.print(getValue(i));

			Serial.print(F(", Age="));
			Serial.println(getAge(i));

			Serial.print(F("   Raw["));
			Serial.print(i);
			Serial.print(F(","));
			Serial.print(value[i].vname);
			Serial.print(F("]="));
			Serial.print(getRawValue(i));
			Serial.print(F(", Age="));
			Serial.println(getRawAge(i));

		}
	}
	Serial.println("");
}
Ejemplo n.º 4
0
    void MetaObject::sendEventImpl(type_index eventType, void* eventPtr) const {
        auto& props = getProperties();
        auto listener = props.getInvokableListener(eventType);

        if (listener) {
            listener(getRawValue(), eventPtr);
        }
	}
Ejemplo n.º 5
0
void CircularBuffer::dump() const
{
    size_t i, num = getCount();
    printf("CircularBuffer type %d, count %d, capacity %d:\n",
           (int)type, (int)count, (int)getCapacity());
    for (i=0; i<num; ++i)
    {
        printf("#%3u: ", (unsigned int)i);
        RawValue::show(stdout, type, count, getRawValue(i));
    }
}
Ejemplo n.º 6
0
void Radio::test()
{
  Serial.println("Testing radio ...");
  uint16_t r1 = getRawValue();
  Serial.println(r1);
  // temp code for testing the other radio channel
  uint16_t r2 = pulseIn(9, HIGH, RADIO_TIMEOUT);
  Serial.println(r2);
  // r1 should be between 990 and 1020, and r2 between 1480 and 1520 to pass the test
  if (r1 < 1120 && r1 > 1060 && r2 > 1060 && r2 < 1120) printMessage(TEST_PASS_MESSAGE);
  else printMessage(TEST_FAIL_MESSAGE);
}
Ejemplo n.º 7
0
const char * SP_NKIniFile :: getValue( const char * section, const char * key,
		char * value, size_t size ) const
{
	const char * ret = getRawValue( section, key, value, size );

	char * pos = NULL;

	// remove tailing comment
	for( pos = value; '\0' != *pos; pos++ ) {
		if( ';' == *pos || '#' == *pos ) {
			*pos = '\0';
			break;
		}
	}

	// remove tailing space
	for( ; pos > value && isspace( *( pos - 1 ) ); ) pos--;
	*pos = '\0';

	return ret;
}
Ejemplo n.º 8
0
void
RemapImage::mouseMoveEvent(QMouseEvent *event)
{
  if (!hasFocus())
    setFocus();

  //QPoint pp = mapFromParent(event->pos());
  QPoint pp = event->pos();
  float ypos = pp.y();
  float xpos = pp.x();

  m_cursorPos = pp;

  if (m_button == Qt::LeftButton)
    {
      if (m_rubberBandActive)
	{
	  updateRubberBand(xpos, ypos);
	  update();
	  return;
	}
    }
  else if (m_button == Qt::RightButton)
    {
      if (validPickPoint(xpos, ypos))
	{
	  emit getRawValue(m_pickDepth,
			   m_pickWidth,
			   m_pickHeight);
	  update();
	  return;
	}
    }
  
  if (m_pickPoint)
    {
      m_pickPoint = false;
      update();
    }
}
Ejemplo n.º 9
0
__attribute__((always_inline)) double GC5883::getRadian()
{
    GC5883RawAxis axis = getRawValue();
    return (double)(atan2(axis.y, axis.x));
}
Ejemplo n.º 10
0
template <typename T> T GC5883::read()
{
    GC5883RawAxis axis = getRawValue();
    return (T)degrees(atan2(axis.y, axis.x));
}
Ejemplo n.º 11
0
const DepthMap in::DepthMap::getValue()
{
    return port::DepthMap::fromVariant(getRawValue());
}
Ejemplo n.º 12
0
uint8_t Light_Sensor::getPercentValue()
{
    const unsigned int maxAdcValue = 4096;
    return (getRawValue() * 100) / maxAdcValue;
}