Merge pull request #205 from cyberman54/master

sync dev to master
This commit is contained in:
Verkehrsrot 2018-11-19 15:37:09 +01:00 committed by GitHub
commit ec979d4b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,13 +60,13 @@ void spi_slave_task(void *param) {
continue; continue;
} }
// fill tx buffer with data to send from queue and calculate crc16 cheksum // fill tx buffer with data to send from queue
uint8_t *messageType = txbuf + 2; uint8_t *messageType = txbuf + 2;
*messageType = msg.MessagePort; *messageType = msg.MessagePort;
uint8_t *messageSize = txbuf + 3; uint8_t *messageSize = txbuf + 3;
*messageSize = msg.MessageSize; *messageSize = msg.MessageSize;
memcpy(txbuf + HEADER_SIZE, &msg.Message, msg.MessageSize); memcpy(txbuf + HEADER_SIZE, &msg.Message, msg.MessageSize);
// calculate crc16 checksum // calculate crc16 checksum over txbuf and insert checksum at pos 0+1 of txbuf
uint16_t *crc = (uint16_t *)txbuf; uint16_t *crc = (uint16_t *)txbuf;
*crc = crc16_be(0, messageType, msg.MessageSize + HEADER_SIZE - 2); *crc = crc16_be(0, messageType, msg.MessageSize + HEADER_SIZE - 2);
@ -173,4 +173,4 @@ void spi_housekeeping(void) {
#ifdef HAS_SPI #ifdef HAS_SPI
ESP_LOGD(TAG, "spiloop %d bytes left", uxTaskGetStackHighWaterMark(spiTask)); ESP_LOGD(TAG, "spiloop %d bytes left", uxTaskGetStackHighWaterMark(spiTask));
#endif #endif
} }