Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/04_Dual_I2C_SingleShot/i2c_interface_soft.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ ENS220::Result I2cInterface::write(const ENS220::RegisterAddress& address, uint8

if( softI2C->i2c_start((slaveAddress<<1)|I2C_WRITE) )
{
int size_int = (int)size;
softI2C->i2c_write((uint8_t)address); // send desired register to device
for( int i=0; i<size; i++)
for( int i=0; i<size_int; i++)
{
softI2C->i2c_write(data[i]); // send data
}
Expand Down
10 changes: 2 additions & 8 deletions examples/05_Event_Detection/05_Event_Detection.ino
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ void detect_events(float p, float t, float m, float d, float alpha) {
}
}





void setup()
{
pinMode(OPTIONAL_LED_PIN, OUTPUT);
Expand All @@ -160,7 +156,7 @@ void setup()
result = ens220.update();
}
first_pressure_Pa = ens220.getPressurePascal();
state = {.first_event_detected = 1, .norm=1, .mean_absolute_deviation=2.0, .p_1=first_pressure_Pa, .t_1=relative_time_ms/1000.};
state = {.event_detected=0, .first_event_lower_than_threshold=0, .first_event_detected=1, .norm=1, .average = 0, .mean_absolute_deviation=2.0, .p_1=first_pressure_Pa, .t_1=relative_time_ms/1000.};

}

Expand Down Expand Up @@ -201,12 +197,10 @@ void ens220_setup()
ens220.startContinuousMeasure(ENS220::Sensor::Pressure);
}



void loop()
{

while ((millis()-last_readout_time_ms) >= (target_sampling_interval_ms)) {
while ((((int)millis())-last_readout_time_ms) >= (target_sampling_interval_ms)) {

// Check the DATA_STAT from the sensor. Read data, if available
relative_time_ms = millis();
Expand Down
4 changes: 2 additions & 2 deletions examples/06_Fall_Detection/06_Fall_Detection.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AlgorithmConstants algorithm_constants; // Algorithm constants struct
// Global variables
float latestPressure = 0;
float latestTemp = 0;
uint32_t maximum_fall_pressure_peak_raw = 0;
int32_t maximum_fall_pressure_peak_raw = 0;
float conversion_pa_to_m = 0;
unsigned long current_ms = 0;

Expand Down Expand Up @@ -101,7 +101,7 @@ void loop()
{
ContinuousModeWithFIFO_loop(meas_buffer);

uint32_t measured_drop_height_raw = 0;
int32_t measured_drop_height_raw = 0;
unsigned long data_collection_finished = millis();
unsigned long curr_time = data_collection_finished - (ENS220_BUFFERSIZE-1) * t_individual_meas_ms;

Expand Down
2 changes: 1 addition & 1 deletion examples/06_Fall_Detection/DropAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct {
int32_t index_window;
int32_t drop_count;
double last_baseline_update;
double spike_height;
int32_t spike_height;
double spike_duration;
} DropDetectionState;

Expand Down