Skip to content
Snippets Groups Projects
Commit be64dbc8 authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

Implement ramps

parent 5e3dc5ef
No related branches found
No related tags found
No related merge requests found
......@@ -161,12 +161,33 @@ int coincellhell_check_ready(struct coincellhell* hell, bool* ready)
int coincellhell_set_temperature_ramp(struct coincellhell* hell, uint8_t heater, time_t end_time, float temperature)
{
time_t currentTime = time(NULL);
time_t timeDelta = end_time - currentTime;
if(timeDelta < 0)
return -1;
char buffer[7];
buffer[0] = heater;
uint32_t microTime = coincellhell_get_seconds(hell);
uint32_t* endTime = (uint32_t*)(buffer+3);
int16_t* setpoint = (int16_t*)(buffer+1);
*endTime = microTime + timeDelta;
*setpoint = temperature/10.0f;
int ret;
while((ret = usbshm_writeControlTransfer(hell->priv, COMMAND_HEATER_SETUP_RAMP, buffer, 7, 0, 0)) == USBSHM_ERROR_AGAIN)
usleep(100000);
return ret;
}
int coincellhell_cancle_ramp(struct coincellhell* hell, uint8_t heater)
{
return -1;
int ret;
while((ret = usbshm_writeControlTransfer(hell->priv, COMMAND_HEATER_RAMP_CANCLE, NULL, 0, 0, heater)) == USBSHM_ERROR_AGAIN)
usleep(100000);
return ret;
}
int coincellhell_set_led(struct coincellhell* hell, bool on)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment