Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BQ274XX Sensors Driver - Fails with CONFIG_BQ274XX_LAZY_CONFIGURE #47458

Closed
ballardr opened this issue Jul 7, 2022 · 1 comment · Fixed by #47498
Closed

BQ274XX Sensors Driver - Fails with CONFIG_BQ274XX_LAZY_CONFIGURE #47458

ballardr opened this issue Jul 7, 2022 · 1 comment · Fixed by #47498
Assignees
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@ballardr
Copy link

ballardr commented Jul 7, 2022

Describe the bug
When using the BQ274XX Sensors driver, there is a kconfig CONFIG_BQ274XX_LAZY_CONFIGURE that allows the device not to be imitated until it's first use. I use this as the communication pull ups in the BQ274XX are disabled on boot (enabled in boot process however).

If CONFIG_BQ274XX_LAZY_CONFIGURE is set however, compilation fails as the following code references a bq274xx struct that doesn't exist. See lines 405-409 of ${zephyr}/drivers/sensor/bq274xx/bq274xx.c

#ifdef CONFIG_BQ274XX_LAZY_CONFIGURE
	bq274xx->lazy_loaded = false;
#else
	status = bq274xx_gauge_configure(dev);
#endif

To Reproduce
Steps to reproduce the behavior:
I'd have thought you should be able to compile the sample ${zephyr}/samples/sensor/bq274xx/ but with the CONFIG_BQ274XX_LAZY_CONFIGURE set to get the error
4. See error

Expected behavior
CONFIG_BQ274XX_LAZY_CONFIGURE should allow the BQ274XX not to be imitated until it's first use

Impact
Compilation failure

Logs and console output

F:/zephyrproject/zephyr/drivers/sensor/bq274xx/bq274xx.c: In function 'bq274xx_gauge_init':
F:/zephyrproject/zephyr/drivers/sensor/bq274xx/bq274xx.c:406:2: error: 'bq274xx' undeclared (first use in this function)
  406 |  bq274xx->lazy_loaded = false;

Environment (please complete the following information):

  • Windows 10
  • Zephyr with GCC
  • zephyr-v3.1.0-1585-ga83cec9f8b
@ballardr ballardr added the bug The issue is a bug, or the PR is fixing a bug label Jul 7, 2022
@ballardr
Copy link
Author

ballardr commented Jul 7, 2022

From looking at elsewhere in file, the code above should be similar to:

#ifdef CONFIG_BQ274XX_LAZY_CONFIGURE
	struct bq274xx_data *bq274xx = dev->data;
	bq274xx->lazy_loaded = false;
#else
	status = bq274xx_gauge_configure(dev);
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants