Altitude - Maths.Floor - Implementation... ?

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
aero
Posts: 7
Joined: Mon Jan 25, 2021 4:36 pm

Altitude - Maths.Floor - Implementation... ?

#1 Post by aero »

I have a few aircraft that when I've rolled in the altitude - 100's - then these persist when then rolling in the - 1000's...
eg - I'm at 2400 feet and set climb to 7000' the readout will show - 7400' .
I've read a bit about - Maths.Floor but can't work out how to write it in.....

Eample from the 'H-Jet AFCS' ----------------

-- alt
function altKnobInnerAction(direction)
if direction == 1 then
fs2020_event("AP_ALT_VAR_INC")
elseif direction == -1 then
fs2020_event("AP_ALT_VAR_DEC")
end
sound_play(dial_snd)
end

function altKnobOuterAction(direction)
if direction == 1 then
---------------------------------------------------------- -- ALT = math.floor(ALT / 1000 + 1) * 1000
fs2020_event("AP_ALT_VAR_INC", 1000)
-- AP_ALT_VAR_SET_ENGLISH)
elseif direction == -1 then
----------------------------------------------------------- -- ALT = math.floor(ALT / 1000 - 1) * 1000
fs2020_event("AP_ALT_VAR_DEC", 1000)
end
sound_play(dial_snd)
end
alt_outer_id = dial_add(nil, 415, 118, 60, 60, altKnobOuterAction)
alt_inner_id = dial_add(nil, 455, 158, 30, 30, altKnobInnerAction)
alt_shadow = img_add("knob_shadow.png", 415, 118, 75, 100)
alt_topper = img_add("knob_topper.png", 420, 128, 50, 50)


This AFCS was adapted to be used with the FSReborn - FSR500.... (Piper M500 - P46T)

Post Reply