cmd queue and planner - functions for calculating sd position:

cmdqueue_calc_sd_length
planner_calc_sd_length
This commit is contained in:
Robert Pelnar 2017-09-18 19:36:18 +02:00
parent 9c92025cf2
commit c4e9e624f5
4 changed files with 42 additions and 4 deletions
Firmware

View file

@ -601,3 +601,20 @@ void get_command()
#endif //SDSUPPORT
}
uint16_t cmdqueue_calc_sd_length()
{
int _buflen = buflen;
int _bufindr = bufindr;
uint16_t sdlen = 0;
while (_buflen--)
{
if (cmdbuffer[_bufindr] == CMDBUFFER_CURRENT_TYPE_SDCARD)
sdlen += cmdbuffer[_bufindr + 1];
//skip header, skip command
for (_bufindr += CMDHDRSIZE; cmdbuffer[_bufindr] != 0; ++ _bufindr) ;
//skip zeros
for (++ _bufindr; _bufindr < sizeof(cmdbuffer) && cmdbuffer[_bufindr] == 0; ++ _bufindr) ;
}
return sdlen;
}