func (tello *Tello) SaveAllPics(prefix string) (np int, err error) {
	for _, f := range tello.files {
		if f.fileType == ftJPEG {
			filename := fmt.Sprintf("%s_%d.jpg", prefix, np)
			err = ioutil.WriteFile(filename, f.fileBytes, 0644)
			if err != nil {
				return 0, err
			}
			np++
		}
	}
	tello.files = nil
	return np, nil
}
SaveAllPics writes all JPEG pictures to disk using the given prefix
and a generated index number. It returns the number of pictures written &/or an error.
If there is no error, the pictures are removed from memory.
package tello
import (
	"fmt"
	"io/ioutil"
	"sort"
)
func (tello *Tello) TakePicture() (err error) {
	tello.ctrlMu.Lock()
	defer tello.ctrlMu.Unlock()
	tello.ctrlSeq++
	pkt := newPacket(ptSet, msgDoTakePic, tello.ctrlSeq, 0)
	tello.ctrlConn.Write(packetToBuffer(pkt))
	return nil
}
func (tello *Tello) sendFileSize() {
	tello.ctrlMu.Lock()
	defer tello.ctrlMu.Unlock()
	tello.ctrlSeq++
	tello.ctrlConn.Write(packetToBuffer(newPacket(ptData1, msgFileSize, tello.ctrlSeq, 1)))
}
func (tello *Tello) sendFileAckPiece(done byte, fID uint16, pieceNum uint32) {
	tello.ctrlMu.Lock()
	defer tello.ctrlMu.Unlock()
	tello.ctrlSeq++
	pkt := newPacket(ptData1, msgFileData, tello.ctrlSeq, 7)
	pkt.payload[0] = done
	pkt.payload[1] = byte(fID)
	pkt.payload[2] = byte(fID >> 8)
	pkt.payload[3] = byte(pieceNum)
	pkt.payload[4] = byte(pieceNum >> 8)
	pkt.payload[5] = byte(pieceNum >> 16)
	pkt.payload[6] = byte(pieceNum >> 24)
	tello.ctrlConn.Write(packetToBuffer(pkt))
}
func (tello *Tello) sendFileDone(fID uint16, size int) {
	tello.ctrlMu.Lock()
	defer tello.ctrlMu.Unlock()
	tello.ctrlSeq++
	pkt := newPacket(ptGet, msgFileDone, tello.ctrlSeq, 6)
	pkt.payload[0] = byte(fID)
	pkt.payload[1] = byte(fID >> 8)
	pkt.payload[2] = byte(size)
	pkt.payload[3] = byte(size >> 8)
	pkt.payload[4] = byte(size >> 16)
	pkt.payload[5] = byte(size >> 24)
	tello.ctrlConn.Write(packetToBuffer(pkt))
}
func (tello *Tello) reassembleFile() {
	var fd fileData
	tello.fdMu.Lock()
	defer tello.fdMu.Unlock()
	fd.fileType = tello.fileTemp.filetype
	fd.fileSize = tello.fileTemp.accumSize
	for _, p := range tello.fileTemp.pieces {
		if p.numChunks > 1 {
			sort.Slice(p.chunks, func(i, j int) bool {
				return int(p.chunks[i].chunkNum) < int(p.chunks[j].chunkNum)
			})
		}
		for _, c := range p.chunks {
			fd.fileBytes = append(fd.fileBytes, c.chunkData...)
		}
	}
	tello.files = append(tello.files, fd)
	tello.fileTemp = fileInternal{}
}
func (tello *Tello) NumPics() (np int) {
	for _, f := range tello.files {
		if f.fileType == ftJPEG {
			np++
		}
	}
	return np
}