MattNJ - Hi, be gentle, im new to this! I have ...

Hi, be gentle, im new to this! I have made an engine monitor, and its mostly working as I need, but i need to use the OneWire values, elsewhere in the code (to show on a display):-
i have float exhaust_temp = 0; at the top of main.cpp and its outputting the correct values to SignalK using the below, but when i read exhaust_temp in the screen function it is always 0 //exhaust temp auto* exhaust_temp = new OneWireTemperature(dts, 1000); exhaust_temp->connect_to(new Linear(1.0, 0.0)) ->connect_to(new SKOutputFloat("propulsion.engine.exhaustTemperature","/Exhaust Temperature/sk_path")); Is working fine, but how to i access the exhaust_temp values elsewhere in my code (i have an update_screen function running regularly and need to access the sensor values to show on the screen) Im sure its super easy? But cant work it out or find and example, thanks
3 Replies
Matti Airas
Matti Airas3d ago
Connect a LambdaConsumer to the producer you want to use and make the lambda save the input to a variable. I'm not on a computer right now so I can't easily give you an example but if you feel you could use one, I can provide one later. But search the examples and the documentation for LambdaConsumer, I think you should get useful results.
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
MattNJ
MattNJOP3d ago
sorted, thanks!

Did you find this page helpful?