Skip to content

Battery Monitor Test Code#21

Open
tanmay-s1 wants to merge 11 commits intomainfrom
tanmay_monitor_testing
Open

Battery Monitor Test Code#21
tanmay-s1 wants to merge 11 commits intomainfrom
tanmay_monitor_testing

Conversation

@tanmay-s1
Copy link
Copy Markdown
Collaborator

No description provided.

@momoka17 momoka17 self-requested a review March 18, 2026 05:37
Copy link
Copy Markdown
Collaborator

@momoka17 momoka17 left a comment

Choose a reason for hiding this comment

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

Thank you for your great work, Tanmay!

I commented for minor changes, so if you read the comment and it looks good, can you click commit changes? It will automatically commit the changes. And once you commit changes, it's good to merge this.

Also, I see vbat_row function in the test code. If the code in the source code is not working, we should fix that and delete this function. But for now, we can just merge this PR and work on those changes in the next PR!

Thank you for your work!

Comment on lines +38 to +51
// /*@brief "Stores battery properties in a map for easy acccess"

// @return "Returns a map of battery properties and their values in millivolts or milliamps"
// */
// void BQ25756::BatteryMonitor::getProperties(int properties[8]) {
// properties[0] = getVac(); // VAC
// properties[1] = getVbat(); // VBAT
// properties[2] = getVfb(); // VFB
// properties[3] = readVrechg(); // VRECHG
// properties[4] = readVbat_lowv(); // VBAT_LOWV
// properties[5] = readIchg(); // ICHG
// properties[6] = getIac(); // IAC
// properties[7] = getIbat(); // IBAT
// }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// /*@brief "Stores battery properties in a map for easy acccess"
// @return "Returns a map of battery properties and their values in millivolts or milliamps"
// */
// void BQ25756::BatteryMonitor::getProperties(int properties[8]) {
// properties[0] = getVac(); // VAC
// properties[1] = getVbat(); // VBAT
// properties[2] = getVfb(); // VFB
// properties[3] = readVrechg(); // VRECHG
// properties[4] = readVbat_lowv(); // VBAT_LOWV
// properties[5] = readIchg(); // ICHG
// properties[6] = getIac(); // IAC
// properties[7] = getIbat(); // IBAT
// }

Delete this block

bm = new BatteryMonitor();
}

void BQ25756::resetRegister()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
void BQ25756::resetRegister()
// Reset register
// Register reset to default values
void BQ25756::resetRegister()

Add commit changes like this :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(Just note for us) Need to replace the i2c.cpp in src because this is the correct file.

b2.adc.enableADCReadingForOneshot();
}


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Report all ADC measurements and charging status

Need a function comment like this

printf("printf now works!\n");
// Check the wiring I2C to set up test correctly
Wire.begin();
Wire.beginTransmission(0x6B);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Wire.beginTransmission(0x6B);

Deleted this function because this is not needed.

}

void loop() {
delay(500);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
delay(500);
delay(500);

Indent fix

Comment on lines +32 to +37
void printVBAT_LOWV() {
uint8_t data = read8bitRegister(PRECHARGE_TERM_CONT);
uint8_t bit2_1Value = (data & 0x06) >> 1;
printf("VBAT_LOW is ");
printf("%d \n", bit2_1Value); //fix this
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder what the purpose of the function here is. The vbat_low function in the main code is not working? We could merge this PR with this function, but please create another PR to remove or fix the function!

//Test the Monitor functions
reportStatus();
delay(500);
printVBAT_LOWV();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, comment

@@ -0,0 +1,39 @@
// Write test code here and call the function in .ino file to run the test
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Write test code here and call the function in .ino file to run the test

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