Originally Posted by
kur4o
I am thinking to add support for real time tuning of most of the closed loop parameters.
mode 4 message slots are 99% full so I will need to come up with something like extending the mode 4 message.
Steveo,
will it be possible instead of 12 bytes eehack to send 14 or 16 bytes message. How hard will be to achieve that.
not too hard. i should have made a #define for the mode 4 message length, but i never thought it would change. lets make it a define.
in config.h, add a line:
Code:
#define M4_LENGTH 12
in datastream.h:
Code:
byte construct_mode4[M4_LENGTH + 4]; // mode4 buffer
then in mode4.cpp:
Code:
void datastream_control::m4_comm_init() {
...
for(x=3;x<M4_LENGTH + 4;x++) construct_mode4[x] = 0x00;
Code:
QString datastream_control::m4_getpkt() {
...
t.setRawData((char *)construct_mode4 +3,M4_LENGTH);
Code:
bool datastream_control::m4_get_request(byte *buf) {
...
for(int x=0;x<M4_LENGTH + 4;x++) buf[x] = construct_mode4[x];
Code:
void datastream_control::m4_get_raw(byte *buf) {
...
for(int x=0;x<M4_LENGTH + 4;x++) buf[x] = construct_mode4[x];
Code:
void datastream_control::m4_set_raw(byte *buf) {
...
for(int x=0;x<M4_LENGTH + 4;x++) construct_mode4[x] = buf[x];
then in datastream.cpp:
Code:
bool datastream::m4_send_if_requested() {
if(control->m4_get_request(buf_out) == true) {
return aldl_request_reply_length(M4_LENGTH + 4,4);
} else {
return true;
}
}
bool datastream::m4_send_force() {
control->m4_get_raw(buf_out);
return aldl_request_reply_length(M4_LENGTH + 4,4,100);
}
i'm pretty sure that covers it, now you can change M4_LENGTH in config.h and recompile for a different length of mode 4 message
if i missed something i'm sure it'll crash and you'll figure it out ...
(edit: fixed bug)
Bookmarks