First Rémi, let me say that I congratulate you for your extremely hard work towards this really useful library. I found telemetry on my personal intent to re-invent the wheel ONCE more. So thank, you and if you help me I will work towards improving and porting your library.
I ported telemetry (plain C) to the K22FN512 (a cortex M4 cpu) platform on the K22F freedom board. I took me a week since I was not very sure how is the actual output string were and how the output should look on the debug serial port I use.
So my first questions are:
(1) Which is the minimal code to port ? I asked this because I have to rewrote the following routines:
void newentry_u8(FILE * file, const char * topic, uint8_t data)
{
fputs("u8", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%hhu", data);
fputs("\t;\t", file);
publish_u8(topic,data);
fputs("\n", file);
}
into this:
void newentry_u8(FILE * file, const char * topic, uint8_t data)
{
PRINTF("u8");
PRINTF("\t;\t");
PRINTF(topic);
PRINTF("\t;\t");
PRINTF("%hhu", data);
PRINTF("\t;\t");
publish_u8(topic,data);
PRINTF("\n");
}
...since my platform does not support fputs.
Is there a more elegant way to do this in Telemetry?
Another issue is the following setup in main:
//
// Telemetry setup
//
transport.write = tlm_write;
transport.read = tlm_read;
then I also rewrote:
int32_t tlm_write(void * buf, uint32_t sizeToWrite)
{
uint8_t * caster = (uint8_t*)(buf);
uint32_t i;
for(i = 0 ; i < sizeToWrite ; i++)
{
// fprintf(output, "%02x", caster[i]);
PRINTF("%02x", caster[i]);
}
}
(2) In the examples you open a file and use fprintf and that is why you use output. Is this necessary ?
In the example:
output = fopen("valid_vectors.csv", "w");
if (output == NULL) {
printf("Failure : Could not open file for write.");
return -1;
}
(3) Can we mix messages ? What I mean with this is that I was planing to use serial as I always do with "general" debug information and plus Telemetry. is this possible, pyTelemetry wont get confused ?
For example this is a direct example of what I'm having now:
Actual dip-switch status is 15
f70100746f706963008a56c77f
Initiating TMP175 temperature read.
Ch.0 (0x 38E), Ch.1 (0x 455)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f706963008b56477f
Initiating TMP175 temperature read.
Ch.0 (0x 3D5), Ch.1 (0x 4C9)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f706963008c357df77f
Initiating TMP175 temperature read.
Ch.0 (0x 228), Ch.1 (0x 3BD)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f706963008d35777f
Initiating TMP175 temperature read.
Ch.0 (0x 251), Ch.1 (0x 4D0)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f706963008e14e77f
Initiating TMP175 temperature read.
Ch.0 (0x 38F), Ch.1 (0x 455)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f706963008f14677f
Initiating TMP175 temperature read.
Ch.0 (0x 24F), Ch.1 (0x 4D3)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f7069630090fb167f
Initiating TMP175 temperature read.
Ch.0 (0x 3BE), Ch.1 (0x 55E)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f7069630091fb967f
Initiating TMP175 temperature read.
Ch.0 (0x 28B), Ch.1 (0x 3D4)
Temp (0x4A59)
Actual dip-switch status is 15
f70100746f7069630092da067f
Initiating TMP175 temperature read.
As you can see Telemetry output is inserted in the middle. Will this work as intended in pyTelemetry ?