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

updated sht driver + header #172

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

updated sht driver + header #172

wants to merge 4 commits into from

Conversation

marvin-g-personal
Copy link

@marvin-g-personal marvin-g-personal commented Oct 10, 2024

Changes

generalized sht driver and header

Notes

  • kept major code the same

To Do

  • after this is done, uses of sht in Shepherd and Cerberus will be updated
  • make test?

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No merge conflicts
  • All checks passing
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes # (issue #160 )

}

temp = uint8_to_uint16(data.databuf[0], data.databuf[1]);
sht30->delay(1u);
Copy link
Contributor

Choose a reason for hiding this comment

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

fair, but lets simplify and not put a delay here, it shouldnt actually be needed. alllows us to remove the delay func ptr entirely


sht30->temp = (uint16_t)val;
uint32_t temp_val = (uint32_t)(175000u * (uint32_t)temp / 65535u - 45000u);
Copy link
Contributor

Choose a reason for hiding this comment

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

these calcs were changed; thats not in scope of this ticket and i dont feel like checking chatgpts math so can we revert

Copy link
Author

Choose a reason for hiding this comment

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

I thought we weren't supposed to use floats directly as per the style guide?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair, I guess I should be more clear in that bc that's a good catch. That part of the style guide refers to data storage. In this case, it's just use as an intermediary value- the final value that's being stored is an int.

It's okay that values along the way are floats.

Either way, we def try to keep tickets to the scope that they are listed as. If you spot anything u think should be addressed otherwise, you can make another ticket to address that

Copy link
Author

Choose a reason for hiding this comment

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

sound good, i'll update the PR after I fix everything up

I2C_HandleTypeDef *i2c_handle;
uint16_t status_reg;
I2C_TransmitFunc i2c_transmit;
I2C_ReceiveFunc i2c_receive;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick but can we change the naming here :

I2C_TransmitFunc --> Write_ptr
I2C_ReceieveFunc --> Read_Ptr
I2C_MemReadFunc --> Mem_Read_Ptr

then the instances to "read', "write"m "mem_read"

@marvin-g-personal
Copy link
Author

changes made

Copy link
Contributor

@dyldonahue dyldonahue left a comment

Choose a reason for hiding this comment

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

there's still a ton of changes here that are not in scope of this ticket. The temp calculation is still done differently, and every single number still ends in "u" - even in areas that you obviously didnt otherwise edit. We dont use that convention; very few people do - auto code generators are the only places who will spit that out regularly. Please revert these changes

Copy link
Contributor

@dyldonahue dyldonahue left a comment

Choose a reason for hiding this comment

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

also, i dont know what these commited binary files are, but please revert them. we dont want these commited

static int sht30_write_reg(sht30_t *sht30, uint16_t command)
{
uint8_t command_buffer[2] = { (command & 0xff00u) >> 8u,
command & 0xffu };
Copy link
Contributor

Choose a reason for hiding this comment

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

this still uses u after all ints. please remove

Choose a reason for hiding this comment

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

I'm confused, the verison in main uses u? I didn't touch it since it wasn't in the scope of the ticket, but i'll remove it and recommit without the .ds files

Copy link
Contributor

@dyldonahue dyldonahue left a comment

Choose a reason for hiding this comment

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

still needs to remove "u" after ints, and the DS store files are sitll here. please remove them

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.

3 participants