Simconnect not setting simvars

Any Ideas whats wrong with this code?

        if (indicated > 1500) {

        std::cout << "above 1500" << std::endl;

        tc.manifoldPressure = 29;

        hr = SimConnect_SetDataOnSimObject(hSimConnect, DEFINITION_MANIFOLD, SIMCONNECT_OBJECT_ID_USER, 0, 0, sizeof(tc), &tc);

    }

The debug “above 1500” runs, but the setting of the manifold does not happen. If I put it into a while() loop, the sim crashes because it overloads the sim with request.

Did you properly „register“ that request data structure with the current SimConnect connection (handle)?

https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_AddToDataDefinition.htm

As @Steeler2340 has suggested, before you can submit the value, you must register the SimVar Data Type with SimConnect.

Call AddToDataDefinition once, then you can call SetDataOnSimObject repeatedly with the values you wish to pass.

If the SimVar is normally controlled by AI, you may also want to disable that using AIReleaseControl

Thanks both for the responses, I figured it out a few days after posting this thread. Because of the FDE setting its own values, it simply woudlnt allow you to set your own. To get around this you can subtract the current manifold pressure to get a difference of 0, and setting what ever manifold pressure you need at the moment, thats how I found it to work for me. Thanks for the help!