The short answer is: you can't.
There is no "current" writer. If a function may need to output text to a
writer, you need to pass the writer pointer to that function.
In case of functions that may be called within a user command execution
and shall then provide output, add the writer to the signature, and only
use it when it's not null. If the output is important, send it to the
log if the writer is null.
If you need to reduce the output for certain output channels, you'll
also want to pass the "verbosity" parameter along with the writer pointer.
Regards,
Michael
Am 13.09.24 um 08:55 schrieb sharkcow via OvmsDev:
> Hi all,
>
> I have a dumb question: how do I get access to the current "writer"
> object in a "regular" function in my vehicle code (not defined by
> RegisterCommand)?
>
> Thanks!
>
> sharkcow
> _______________________________________________
> OvmsDev mailing list
> OvmsDev@lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
_______________________________________________
OvmsDev mailing list
OvmsDev@lists.openvehicles.com
http://lists.openvehicles.com/mailman/listinfo/ovmsdev