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

DeviceInfo i2cscanner #88

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

DeviceInfo i2cscanner #88

wants to merge 7 commits into from

Conversation

malarz-supla
Copy link
Contributor

DeviceInfo I2C scanner for WebInterface

list addresses of all detected i2c devices

DeviceInfo I2C scanner
added include library
Copy link
Member

@klew klew left a comment

Choose a reason for hiding this comment

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

Fix cpplint issues:
src/supla/network/html/i2cscanner.h:19: #ifndef header guard has wrong style, please use: SRC_SUPLA_NETWORK_HTML_I2CSCANNER_H_ [build/header_guard] [5]
src/supla/network/html/i2cscanner.h:53: #endif line should be "#endif // SRC_SUPLA_NETWORK_HTML_I2CSCANNER_H_" [build/header_guard] [5]
src/supla/network/html/i2cscanner.h:34: Missing space before ( in for( [whitespace/parens] [5]
src/supla/network/html/i2cscanner.h:34: Mismatching spaces inside () in for [whitespace/parens] [5]
src/supla/network/html/i2cscanner.h:40: Never use sprintf. Use snprintf instead. [runtime/printf] [5]
src/supla/network/html/i2cscanner.h:47: Redundant blank line at the end of a code block should be deleted. [whitespace/blank_line] [3]
src/supla/network/html/i2cscanner.h:48: At least two spaces is best between code and comments [whitespace/comments] [2]
src/supla/network/html/i2cscanner.h:50: At least two spaces is best between code and comments [whitespace/comments] [2]
src/supla/network/html/i2cscanner.h:51: At least two spaces is best between code and comments [whitespace/comments] [2]

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License898
Copy link
Member

Choose a reason for hiding this comment

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

remove 898 from the end of this line

void send(Supla::WebSender* sender) {
sender->send("<span>");
sender->send("<br>I2C: ");
for(byte address = 1; address < 127; address++ ) {
Copy link
Member

Choose a reason for hiding this comment

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

use "uint8_t" instead of "byte" ( include <stdint.h>)

char buffer[2];
if (error == 0) {
sender->send("0x");
sprintf(buffer, "%2x", address);
Copy link
Member

Choose a reason for hiding this comment

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

use snprintf instead. Current version will add 3 charcters to buffer which size is only 2 B.

namespace Supla {
namespace Html {

class I2Cscanner : public Supla::HtmlElement {
Copy link
Member

Choose a reason for hiding this comment

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

add a description what is this class doing in Doxygen format

Comment on lines 50 to 51
}; // namespace Html
}; // namespace Supla
Copy link
Member

Choose a reason for hiding this comment

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

remove not needed ;

@malarz-supla malarz-supla requested a review from klew February 27, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants