<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I have a function named
<b>oled_write_temp</b>
in a.c, if i dont declare it in a.h , then i will get the wrong
supply value in the function within main call, why?</div><div><br></div><div>if i
declare it in a.h, then all is right<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>void oled_write_temp(float set_temp, const float supply, float return_temp)<br>{<br><br> int base_x = 12, base_y = 60;<br><br> char buffer[20] = {0};<br><br> <b>printf("supply_temp %f at %s\n", supply, __FUNCTION__);</b><br> <br> snprintf(buffer, 20, "SUPPLY:%.2f", supply);<br> printf("supply_temp string %s\n", buffer);<br><br> oled_clear_area(base_x, base_y + 16, 122, base_y + 32);<br> OLED_ShowString(base_x, base_y + 16, buffer, 16, 1);<br><br> memset(buffer, 0, sizeof(buffer));<br> snprintf(buffer, 20, "RETURN:%.2f", return_temp);<br> OLED_ShowString(base_x, base_y + 36, buffer, 16, 1);<br><br> memset(buffer, 0, sizeof(buffer));<br> snprintf(buffer, 20, "SET :%.2f", set_temp);<br> OLED_ShowString(base_x, base_y + 56, buffer, 16, 1);<br><br>}<br></div></blockquote><div><br></div><div>ps: watch line
<b>printf("supply_temp %f at %s\n", supply, __FUNCTION__);</b>
</div></div></div></div>