Should I be casting within that function? Should I do that elsewhere first? Is this going to cause unknown issues?
This is for a timer, and the variables min_counter and sec_counter of course are type Unsigned Long.
Sorry, they weren't going to exceed that. I was looking over some old code and apparently I changed the variables to uint8_t long ago.. Probably should not have assumed, and I should probably update the snprintf
Your snprintf format string indicates you are passing two int arguments, but the actual arguments are actually passed as int8_t. That is not going to print the correct values.
Should. Before being placed on the "stack" they should be converted to int. I believe the C standard doesn't allow anything smaller to be passed as an argument. This appears to confirm.
But, the value sizes really should match the formats.
Ok, I was passing int16_t variable values into a function that was taking const int16_t as arguments.. Not sure why that was really causing the very strange behavior, but when I changed the types from const, it fixed everything. Very elusive to figure out because that code portion was pretty old and worked in other code, but it also was being passed the information correctly in the other code!