Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

I2CComponent::write_byte_16 writes 0 words #78

Closed
schumar opened this issue Jun 9, 2018 · 8 comments
Closed

I2CComponent::write_byte_16 writes 0 words #78

schumar opened this issue Jun 9, 2018 · 8 comments

Comments

@schumar
Copy link

schumar commented Jun 9, 2018

https://github.com/OttoWinter/esphomelib/blob/249e0b527360e3bc93dcc9b97f698d3f3cb072a9/src/esphomelib/i2c_component.cpp#L196

After changing this to

return this->write_bytes_16(address, register_, &data, 1);

communicating with a ADS1115 suddenly works :)

@OttoWinter
Copy link
Member

Oh! Thank you so much! That would have been a nightmare to debug (I hope you didn't have to debug for too long... My mistake)

@schumar
Copy link
Author

schumar commented Jun 9, 2018

It wasn't "fun" to debug, in the end I used my Logic Analyzer and hooked it up to see what was going on :)
But don't worry, thanks a lot for esphomelib!

@OttoWinter
Copy link
Member

Oh noes... Sorry about that.

As a tip, you can set the debug level to VERY_VERBOSE and you will see the entire i2c traffic in the logs 😉 https://esphomelib.com/esphomeyaml/components/logger.html

@schumar
Copy link
Author

schumar commented Jun 9, 2018

Sorry for replying to this closed ticket, but I'm trying to debug an issue with TSL2561, and wanted to set the logging level as you suggested:

#define ESPHOMELIB_LOG_LEVEL ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE
#include <esphomelib.h>
// [...]
    auto *log = App.init_log(230400);
    log->set_global_log_level(ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE);

but I don't get any additional log entries :(

@OttoWinter
Copy link
Member

That would be because #define before an include only works with header-only libraries :)

So to set the log level to very verbose you need to set it inside platformio.ini:

[env:YOUR_ENV]
build_flags = -DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE

@schumar
Copy link
Author

schumar commented Jun 9, 2018

Do you know an easy way to do this using Arduino?

@OttoWinter
Copy link
Member

Puh... that might be difficult. I've never really used the Arduino IDE before, but maybe this could help?

@schumar
Copy link
Author

schumar commented Jun 9, 2018

I decided to simply cheat, by modifying log.h :)

@esphome esphome locked and limited conversation to collaborators Jun 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants