|
@ -520,18 +520,15 @@ BaseFilter* _magnitudeCreateFilter(unsigned char type, size_t size) { |
|
|
case MAGNITUDE_ENERGY: |
|
|
case MAGNITUDE_ENERGY: |
|
|
filter = new LastFilter(); |
|
|
filter = new LastFilter(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case MAGNITUDE_COUNT: |
|
|
|
|
|
case MAGNITUDE_GEIGER_CPM: |
|
|
|
|
|
case MAGNITUDE_GEIGER_SIEVERT: |
|
|
case MAGNITUDE_ENERGY_DELTA: |
|
|
case MAGNITUDE_ENERGY_DELTA: |
|
|
filter = new SumFilter(); |
|
|
filter = new SumFilter(); |
|
|
break; |
|
|
break; |
|
|
case MAGNITUDE_DIGITAL: |
|
|
case MAGNITUDE_DIGITAL: |
|
|
filter = new MaxFilter(); |
|
|
filter = new MaxFilter(); |
|
|
break; |
|
|
break; |
|
|
// For geiger counting moving average filter is the most appropriate if needed at all.
|
|
|
|
|
|
case MAGNITUDE_COUNT: |
|
|
|
|
|
case MAGNITUDE_GEIGER_CPM: |
|
|
|
|
|
case MAGNITUDE_GEIGER_SIEVERT: |
|
|
|
|
|
filter = new MovingAverageFilter(); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
default: |
|
|
filter = new MedianFilter(); |
|
|
filter = new MedianFilter(); |
|
|
break; |
|
|
break; |
|
@ -2752,24 +2749,8 @@ void sensorLoop() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
magnitude.last = value_raw; |
|
|
magnitude.last = value_raw; |
|
|
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
|
|
|
|
// Processing (filters)
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
magnitude.filter->add(value_raw); |
|
|
magnitude.filter->add(value_raw); |
|
|
|
|
|
|
|
|
// Special case for MovingAverageFilter
|
|
|
|
|
|
switch (magnitude.type) { |
|
|
|
|
|
case MAGNITUDE_COUNT: |
|
|
|
|
|
case MAGNITUDE_GEIGER_CPM: |
|
|
|
|
|
case MAGNITUDE_GEIGER_SIEVERT: |
|
|
|
|
|
value_raw = magnitude.filter->result(); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------
|
|
|
// -------------------------------------------------------------
|
|
|
// Procesing (units and decimals)
|
|
|
// Procesing (units and decimals)
|
|
|
// -------------------------------------------------------------
|
|
|
// -------------------------------------------------------------
|
|
|