Skip to content

Conversation

@irvingywang
Copy link
Contributor

@irvingywang irvingywang commented Jan 20, 2026

Useful for BMS and Dashboard LCD code

Copy link
Contributor

@LelsersLasers LelsersLasers left a comment

Choose a reason for hiding this comment

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

I thought like 2% more about BMS since we last talked and I think a buffer type would not really be helpful as 99% of the time we will need to know which IC/BMS in the chain we are looking at/talking to and that will determine the index into a static buffer we write to instead of for i in bms_count: push(string).

Not that I don't think that the buffer type wouldn't be useful for other things though or even for easier writing of test code.

}

typedef struct {
uint8_t *data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Small: could be good to put a comment that data should live as the buffer

buf->length = 0;
}

bool buffer_append(byte_buffer_t *buf, const void *data, size_t length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think for most of what I could imagine us using a buffer type for right now we only care if we had a enough space or not, but I think it could be a good idea to slight future proof this and have it return size_t which is the number of bytes written from data into buf.

size_t max_len;
} byte_buffer_t;

void buffer_clear(byte_buffer_t *buf);
Copy link
Contributor

Choose a reason for hiding this comment

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

Small: short comments? (Ex: clear: sets length to 0, does not affect contents of data?)

@irvingywang
Copy link
Contributor Author

I thought like 2% more about BMS since we last talked and I think a buffer type would not really be helpful as 99% of the time we will need to know which IC/BMS in the chain we are looking at/talking to and that will determine the index into a static buffer we write to instead of for i in bms_count: push(string).

Not that I don't think that the buffer type wouldn't be useful for other things though or even for easier writing of test code.

even if not used for BMS, Dashboard certainly needs it

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