编辑代码

#include <stdio.h>

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

uint16_t graphic_temp_table5_calc(uint16_t temp)
{
	uint16_t calc_temp = 0;
	
	if (temp >= 140 && temp < 175) calc_temp = temp - 40;
	else if (temp >= 175 && temp < 235) calc_temp = temp - 40 - (temp - 175) / (235 - 175)*(30 - 40);
	else if (temp >= 235 && temp < 241) calc_temp = temp - 30;
	else if (temp >= 241 && temp < 251) calc_temp = temp - 30 - (temp - 241) / (250 - 241)*(36 - 30);
	else if (temp >= 251 && temp < 280) calc_temp = temp - 36;
	else calc_temp = temp;
	
	return calc_temp;
}

int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    printf("Calc temp:%d\n", graphic_temp_table5_calc(178));
    return 0;
}