Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed memory on Wire instance#2196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 1 commit intostm32duino:mainfromgbr1:main
Nov 22, 2023
Merged

Fixed memory on Wire instance#2196

fpistm merged 1 commit intostm32duino:mainfromgbr1:main
Nov 22, 2023

Conversation

gbr1
Copy link
Contributor

Fixing memory cleanup on Wire instance

Summary

The constructor doesn't cleanup memory for a wire instance.

Issues could happen, such as wrong initialization.

This PR fixes/implements the followingbugs/features

  • Issue on locked/bad allocated i2c on turning on

Example of bad behaviour using a STM32F411 and an APDS9960 sensor:

#include"Arduino_APDS9960.h"APDS9960 * apds;TwoWire * wire;voidsetup() {  Serial.begin(115200);  wire=newTwoWire(PB7,PB8);  wire->begin();  apds =newAPDS9960(*wire,PC10);  apds->begin();}voidloop() {if (apds->proximityAvailable()) {int value = apds->readProximity();    Serial.println(value);  }}

The bad behaviour is that after turn off and on the board, wire locks.
Note: it works if you go from boot mode to running mode

This pull request solve this issue adding the following line in TwoWire constructors.

memset((void*)&_i2c, 0, sizeof(_i2c));

@gbr1
Copy link
ContributorAuthor

cc@facchinm

@fpistmfpistm added enhancementNew feature or request fix 🩹Bug fix labelsNov 21, 2023
@fpistmfpistm added this to the2.7.1 milestoneNov 21, 2023
@fpistmfpistm self-requested a reviewNovember 21, 2023 14:59
@fpistm
Copy link
Member

Hi@gbr1
Thanks for this PR.
If you can update with the astyle fixed, please.

The constructor doesn't cleanup memory for a wire instance.Issues could happen, such as wrong initialization during bootSigned-off-by: Giovanni Bruno <giovannididio.bruno@gmail.com>
@fpistmfpistm added bug 🐛Something isn't working and removed enhancementNew feature or request labelsNov 21, 2023
Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.
Thanks@gbr1

@fpistmfpistm merged commit61a41ec intostm32duino:mainNov 22, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fpistmfpistmfpistm approved these changes

Assignees
No one assigned
Labels
bug 🐛Something isn't workingfix 🩹Bug fix
Projects
Milestone
2.7.1
Development

Successfully merging this pull request may close these issues.

2 participants
@gbr1@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp