void OscilloscopeChannel::setDeltaTimeStamp(t_TimeStamp newDelta)
{
    if ( newDelta!=0 && newDelta!=DeltaTimeStamp )
    {
        resetSamples();
        DeltaTimeStamp = newDelta ;
    }
}
void OscilloscopeChannel::reset()
{

	resetSamples();

    LatestValidTimeStamp = 0 ;

    SamplesLocked = false ;

}
Exemple #3
0
TempStatus* TempMonitor::status() {
  if(temp_samples.samples < 1)
    return &temp_status;

  temp_status = (TempStatus){
    (temp_samples.ambient) / (temp_samples.samples),
    (temp_samples.boiler) / (temp_samples.samples / 2),
    (temp_samples.brewgroup) / (temp_samples.samples / 2) 
  };

  resetSamples();
  return &temp_status;
}
Exemple #4
0
void Analog::update()
{
    if (!board.analogDataAvailable())
        return;

    addAnalogSamples();

    if (!analogValuesSampled())
        return;

    uint16_t analogData;

    //check values
    for (int i=0; i<MAX_NUMBER_OF_ANALOG; i++)
    {
        //don't process component if it's not enabled
        if (!database.read(CONF_BLOCK_ANALOG, analogEnabledSection, i))
            continue;

        if (database.read(CONF_BLOCK_ANALOG, analogTypeSection, i) != aType_button)
        {
            analogData = getAverageValue(i);
            analogType_t type = (analogType_t)database.read(CONF_BLOCK_ANALOG, analogTypeSection, i);

            switch(type)
            {
                case aType_potentiometer:
                checkPotentiometerValue(i, analogData);
                break;

                case aType_fsr:
                checkFSRvalue(i, analogData);
                break;

                default:
                break;
            }
        }
        else
        {
            analogData = board.getAnalogValue(i);
            bool state = analogData > DIGITAL_VALUE_THRESHOLD;
            buttons.processButton(i+MAX_NUMBER_OF_BUTTONS, state, false);
        }
    }

    resetSamples();
}