trice icon indicating copy to clipboard operation
trice copied to clipboard

Feature: Generic TriceID

Open KammutierSpule opened this issue 3 weeks ago • 4 comments

Would be possible to be able to generate TriceIDs such way that, eg:

my_error_report_function(stuff, triceID) { // do my stuff Trice(triceID); // send triceID }

my_error_report_function(my_stuff, TRiceID(0));// <- this will generate a trice id on "trice insert"

?

KammutierSpule avatar Dec 09 '25 17:12 KammutierSpule

Would you please elaborate the use case more in detail? Currently I do not understand the question.

When writing Trice( "err:An error\n" ); you can do trice insert -IDRange err:10,99 -IDRange msg:100,999 -IDmethod upward ... for example and control the ID generation.

rokath avatar Dec 09 '25 21:12 rokath

My idea is to take advantage of the "ID system of try" but instead of the ID be used "inline", it will be passed to another function, that will later call some Trice method to send it.

Looking to the til type, I see there is associated an ID to a "Type"... so not sure if this will be possible.

Here is a tentative to better illustrate:

void my_error_handler(triceID) {
taskID = GetOSCurrentTask();
TRice32("Application error, while in task 0x%04X, ", taskID);
TRice0("Message: ");
TRiceN(triceID); // ?
}
my_error_handler( Generates Here a Trice ID );

KammutierSpule avatar Dec 10 '25 09:12 KammutierSpule

I am still not getting the point. What would be the real advantage compared to the current state? Please describe it more verbose. For example your 3 Trice messages are overkill. That all will fit into one singe Trice message. You could also write: TRice32( iD(66), "Application error, while in task 0x%04X, Message: %d", taskID, anyID); and forcing ID 66 for this Trice message. The Trice tool will simply add it to til.json silently, if not used already elsewhere.

Please do not forget, that there is a location information file li.json as well.

BTW: TRiceN is for not-null-trerminated strings: triceN("sig:name:%s\n", ptr, len );, where ptr points to a character sequence, for example in FLASH memory and len is the count of characters to display.

rokath avatar Dec 10 '25 17:12 rokath

That was a tentative to get a example case, I don't have a real use case for now... I will try it latter.

but the main thing, correct me if I'm wrong or other cases, is that the generated trice IDs were meant to be used on/by the same ("Trice") line they are generated.

KammutierSpule avatar Dec 10 '25 18:12 KammutierSpule

Let's close this for now. Once you have a real use case, please re-open.

rokath avatar Dec 11 '25 09:12 rokath