Just an idea of the code difference:
Old code events:
New code events()
alot cleaner than the STL methods!
even the F&F has only 1 memmove to do now
no more shuffling entries anymore
I also noticed I left the FASTRUN entries in place, gonna reflash master & slave to not use it and report back
EDIT: works without FASTRUN
EDIT2: no errors mean all consecutive entries are intact without loss! at 20ms intervals the 64 queued arrays are being recycled over, and over, and over, and over, in a incremental pattern!
EDIT3, also forgot to mention, events() are in main loop for both master & slave. So looking good so far
EDIT4, added master println statement to print when toggling led on slave console:
Slave output:
Old code events:
Code:
if ( _slave_handler == nullptr ) {
if ( teensy_handler_queue.size() > 0 ) teensy_handler_queue.pop_front();
return 0;
}
if ( teensy_handler_queue.size() > 0 ) {
auto _deque = move(teensy_handler_queue.front());
teensy_handler_queue.pop_front();
uint16_t checksum = 0, _deque_pos = 0, _buf[_deque[3]];
for ( uint16_t i = 0; i < _deque[1] - 1; i++ ) checksum ^= _deque[i];
memmove (&_buf[0], &_deque[5], _deque[3] * 2 );
if ( _slave_handler != nullptr ) {
AsyncMST info;
if ( checksum != _deque[_deque[1] - 1] ) info.error = 1;
info.packetID = _deque[4];
_slave_handler(_buf, _deque[3], info);
return 0;
}
}
Code:
if ( mtsca.size() > 0 ) {
uint16_t checksum = 0, buf_pos = 0, len = mtsca.front()[3], buf[len]; AsyncMST info;
for ( uint16_t i = 0; i < mtsca.front()[1] - 1; i++ ) checksum ^= mtsca.front()[i];
( checksum == mtsca.front()[mtsca.front()[1]-1] ) ? info.error = 0 : info.error = 1;
info.packetID = mtsca.front()[4];
len = mtsca.front()[3];
memmove (&buf[0], &mtsca.front()[5], mtsca.front()[3] * 2 );
mtsca.pop_front();
if ( _slave_handler != nullptr ) _slave_handler(buf, len, info);
}
alot cleaner than the STL methods!
even the F&F has only 1 memmove to do now
Code:
_slave_pointer->SPI_MSTransfer::mtsca.push_back(data,len);
no more shuffling entries anymore
I also noticed I left the FASTRUN entries in place, gonna reflash master & slave to not use it and report back
EDIT: works without FASTRUN
EDIT2: no errors mean all consecutive entries are intact without loss! at 20ms intervals the 64 queued arrays are being recycled over, and over, and over, and over, in a incremental pattern!
EDIT3, also forgot to mention, events() are in main loop for both master & slave. So looking good so far
EDIT4, added master println statement to print when toggling led on slave console:
Code:
if ( !(millis() % 1000) ) {
teensy_gpio.println("Toggled Led");
teensy_gpio.pinToggle(LED_BUILTIN); Serial.print("^LT"); delay(1);
}
Slave output:
Code:
0.000000, 0.0487, 0.0487,2792940.000000,2792997.250000,48748.0000, 220.7918, 220.7940, 220.7963,48752.0000,48753.0000,48754.0000
0.000000, 0.0488, 0.0488,2793627.500000,2793684.750000,48760.0000, 220.8189, 220.8212, 220.8235,48764.0000,48765.0000,48766.0000
0.000000, 0.0488, 0.0488,2794315.000000,2794372.250000,48772.0000, 220.8461, 220.8484, 220.8506,48776.0000,48777.0000,48778.0000
0.000000, 0.0488, 0.0488,2795002.500000,2795059.750000,48784.0000, 220.8733, 220.8755, 220.8778,48788.0000,48789.0000,48790.0000
0.000000, 0.0488, 0.0488,2795690.000000,2795747.500000,48796.0000, 220.9004, 220.9027, 220.9050,48800.0000,48801.0000,48802.0000
0.000000, 0.0488, 0.0488,2796377.750000,2796435.000000,48808.0000, 220.9276, 220.9299, 220.9321,48812.0000,48813.0000,48814.0000
0.000000, 0.0488, 0.0488,2797065.250000,2797122.500000,48820.0000, 220.9547, 220.9570, 220.9593,48824.0000,48825.0000,48826.0000
Toggled Led
0.000000, 0.0488, 0.0488,2797752.750000,2797810.000000,48832.0000, 220.9819, 220.9842, 220.9864,48836.0000,48837.0000,48838.0000
0.000000, 0.0488, 0.0488,2798440.250000,2798497.500000,48844.0000, 221.0090, 221.0113, 221.0136,48848.0000,48849.0000,48850.0000
0.000000, 0.0489, 0.0489,2799127.750000,2799185.250000,48856.0000, 221.0362, 221.0385, 221.0407,48860.0000,48861.0000,48862.0000
0.000000, 0.0489, 0.0489,2799815.500000,2799872.750000,48868.0000, 221.0633, 221.0656, 221.0679,48872.0000,48873.0000,48874.0000
0.000000, 0.0489, 0.0489,2800503.000000,2800560.250000,48880.0000, 221.0905, 221.0927, 221.0950,48884.0000,48885.0000,48886.0000
0.000000, 0.0489, 0.0489,2801190.500000,2801247.750000,48892.0000, 221.1176, 221.1199, 221.1221,48896.0000,48897.0000,48898.0000
0.000000, 0.0489, 0.0489,2801878.000000,2801935.250000,48904.0000, 221.1447, 221.1470, 221.1493,48908.0000,48909.0000,48910.0000
0.000000, 0.0489, 0.0489,2802565.500000,2802623.000000,48916.0000, 221.1719, 221.1741, 221.1764,48920.0000,48921.0000,48922.0000
Last edited: