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

Add coding standards, language pack size check during compiling, fix incorrect temperature for mixing hotend, reduce program memory usage #1427

Merged
merged 12 commits into from
Dec 25, 2020
Prev Previous commit
Next Next commit
fix wrong temperature for mixing hotend
  • Loading branch information
guruathwal committed Dec 24, 2020
commit 890bd4513cf0786cce5de89e39905717b209136c
27 changes: 22 additions & 5 deletions TFT/src/User/API/Temperature.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,45 @@ static bool heat_send_waiting[MAX_HEATER_COUNT];

uint32_t nextHeatCheckTime = 0;

static uint8_t fixHeaterIndex(uint8_t index)
{
if (infoSettings.hotend_count == 1)
index = (index < MAX_HOTEND_COUNT) ? NOZZLE0 : index;
return index;
}

//Set target temperature
void heatSetTargetTemp(uint8_t index, int16_t temp)
{
index = fixHeaterIndex(index);
heater.T[index].target = NOBEYOND(0, temp, infoSettings.max_temp[index]);
}

//Sync target temperature
void heatSyncTargetTemp(uint8_t index, int16_t temp)
{
index = fixHeaterIndex(index);
lastTarget[index] = heater.T[index].target = temp;
}

//Get target temperature
u16 heatGetTargetTemp(uint8_t index)
{
index = fixHeaterIndex(index);
return heater.T[index].target;
}

// Set current temperature
void heatSetCurrentTemp(uint8_t index, int16_t temp)
{
index = fixHeaterIndex(index);
heater.T[index].current = NOBEYOND(-99, temp, 999);
}

// Get current temperature
int16_t heatGetCurrentTemp(uint8_t index)
{
index = fixHeaterIndex(index);
return heater.T[index].current;
}

Expand Down Expand Up @@ -176,32 +189,36 @@ void updateNextHeatCheckTime(void)

void loopCheckHeater(void)
{
if (!infoMachineSettings.autoReportTemp) // TFT need not M105 to query the temperature, but uses M155 to automatically report if motherboard supports AUTO_REPORT_TEMPERATURESS feature
// Send M105 to query the temperatures, if motherboard does not supports M155 (AUTO_REPORT_TEMPERATURES) feature
// to automatically report the temperatures.
if (!infoMachineSettings.autoReportTemp)
{
do
{ // Send M105 query temperature continuously
{
// Send M105 query temperature continuously
if (heat_update_waiting == true)
{
updateNextHeatCheckTime();
break;
}
if (OS_GetTimeMs() < nextHeatCheckTime)
break;
if (requestCommandInfoIsRunning()) // To avoid colision in Gcode response processing
if (requestCommandInfoIsRunning()) // To avoid colision in Gcode response processing
break;
if (storeCmd("M105\n") == false)
break;
updateNextHeatCheckTime();
heat_update_waiting = true;
}
while(0);
} while (0);
}

// Query the heater that needs to wait for the temperature to rise, whether it reaches the set temperature
for (uint8_t i = 0; i < MAX_HEATER_COUNT; i++)
{
if (heater.T[i].waiting == WAIT_NONE)
{
continue;
}
else if (heater.T[i].waiting == WAIT_HEATING)
{
if (heater.T[i].current + 2 <= heater.T[i].target)
Expand Down