Hello,
It seems that I have a massive gap in my understanding and was asking the wrong question as per my last thread post.
With the earlier nanopb generated ServoTarget.pb.h, earlier Mr. Petteri mentioned
"If you are going to allocate constant amount of storage for the repeated
field, you can just use field option "max_count = 20" and nanopb will handle
the array automatically. No need to use callbacks."
I'm assuming that this field option is actually message_actuation_ServoTarget_size. Or do I have to put that in the header myself?
Also by stating that callbacks do not have to be used, does it mean that I could just get away with doing the lines below:
// Decoding time
pb_istream_t input_stream = pb_istream_from_buffer(reinterpret_cast<const pb_byte_t*>(&pb_packets[0]), rx_buf_len - rx_buf_idx);
// Instance of ServoTargets to store the decoded messages
message_actuation_ServoTargets msg = message_actuation_ServoTargets_init_zero;
// Decode the ServoTargets message
if (!pb_decode(&stream, message_actuation_ServoTargets_fields, &msg)) {
// Decoding failed
return 1;
}
and access each entry as msg.targets[i] iteratively?
Thank you very much in advance for the help! Advanced Happy New year