Skip to content

Commit

Permalink
[BMP3xx] Fix saving I2C address
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Sep 6, 2023
1 parent 04fcecd commit 4a6fb87
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/_P154_BMP3xx.ino
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ boolean Plugin_154(uint8_t function, struct EventStruct *event, String& string)
break;
}

if (!P154_data->begin()) {
break;
}

success = P154_data->read(UserVar[event->BaseVarIndex], UserVar[event->BaseVarIndex + 1]);
break;
}

case PLUGIN_WEBFORM_SAVE:
{
success = P154_data_struct::webformSave(event);
break;
}

}
return success;
}
Expand Down
6 changes: 6 additions & 0 deletions src/src/PluginStructs/P154_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ bool P154_data_struct::read(float& temp, float& pressure)
return true;
}

bool P154_data_struct::webformSave(struct EventStruct *event)
{
P154_I2C_ADDR = getFormItemInt(F("i2c_addr"));
return true;
}

#endif // ifdef USES_P154
2 changes: 2 additions & 0 deletions src/src/PluginStructs/P154_data_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct P154_data_struct : public PluginTaskData_base {

bool read(float& temp, float& pressure);

static bool webformSave(struct EventStruct *event);

private:

Adafruit_BMP3XX bmp;
Expand Down

0 comments on commit 4a6fb87

Please sign in to comment.