NRF5: Updates for Jenkins verifier (#852)

This commit is contained in:
Olivier
2017-05-21 08:41:11 +02:00
committed by GitHub
parent 6e648f58da
commit e041bf4d74
6 changed files with 24 additions and 16 deletions
+7 -7
View File
@@ -71,14 +71,14 @@
#include <MySensors.h>
// Setting up format for reading 3 soil sensors
#define NUM_READS 10 // Number of sensor reads for filtering
#define NUM_READS (int)10 // Number of sensor reads for filtering
#define CHILD_ID 0
MyMessage msg(CHILD_ID, V_LEVEL);
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
long buffer[NUM_READS];
int index;
int idx;
/// @brief Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
typedef struct {
@@ -179,10 +179,10 @@ void measure (int phase_b, int phase_a, int analog_input)
// Averaging algorithm
void addReading(long resistance)
{
buffer[index] = resistance;
index++;
if (index >= NUM_READS) {
index = 0;
buffer[idx] = resistance;
idx++;
if (idx >= NUM_READS) {
idx = 0;
}
}
@@ -193,4 +193,4 @@ long average()
sum += buffer[i];
}
return (long)(sum / NUM_READS);
}
}