vranki / ExtPlane

Plugin for X-Plane flight simulator which allows reading and writing simulation properties
138 stars 44 forks source link

Accuracy seems to be ignored #42

Closed mortara closed 3 years ago

mortara commented 5 years ago

It seems, as if the accuracy parameter only has effect for datadatarefs. Is this correct?

vranki commented 5 years ago

It has no effect on data datarefs.

mortara commented 5 years ago

It seems to have no effect on normal datarefs. For example, try to subscribe to sim/cockpit2/engine/indicators/ http://www.xsquawkbox.net/xpsdk/phpwiki/index.php?sim/cockpit2/engine/indicators/ engine_speed_rpm http://www.xsquawkbox.net/xpsdk/phpwiki/index.php?sim/cockpit2/engine/indicators/engine_speed_rpm with an accuracy of 1 and you will get constant updates of this dataref, even if the RPM stays the same ...

Am Di., 11. Dez. 2018 um 10:24 Uhr schrieb Ville Ranki < notifications@github.com>:

Closed #42 https://github.com/vranki/ExtPlane/issues/42.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vranki/ExtPlane/issues/42#event-2018118239, or mute the thread https://github.com/notifications/unsubscribe-auth/AQttA8O_Fr5Wvq0vmCnLpfyXqvDXNeqkks5u33nngaJpZM4ZMW0H .

vranki commented 5 years ago

Ok, if it's ignored on normal datarefs, it's a clear bug.

sum1els commented 5 years ago

I reckon for float arrays, that first if block always get matched, even with an accuracy set, the dref is in the hash map, insert values and send data ?

        if(_refValueFA.contains(ref) || refF->accuracy() == 0) {
            // New value or accuracy not set.
            _refValueFA.insert(ref, values);
        } else {
            long length = values.size();

            for (int i=0; i<length;i++){
                if (qAbs(values.at(i) - _refValueFA.value(ref).at(i)) > ref->accuracy()) {
                    bigenough = true;
                    break;
                }
            }
            if (bigenough){ // Values have changed enough
                _refValueFA.insert(ref, values);
            } else {
                return;
            }
        }

i guess it should be, if in the hash map and accuracy is 0, then .... else, check if value changed enough

Clamb94 commented 5 years ago

I noticed the accuracy does not work with dataref arrays, like sim/cockpit2/electrical/battery_amps

"Normal" datarefs seem to be working fine for me