# Operating the hoist

There are V1 and V2 APIs for manipulating the hoist.

Hoist APIs

API V1 or V2 Remarks
fn.HOIST_SEND_TO_GROUND V1 Send the hoist to the ground when conditions are met
fn.HOIST_REEL_UP_AND_STOW V1 Reel up the hoist and stow it
fn.HOIST_REEL_UP V1 Reel up the hoist only
hoist_control V2 Provides direct control over reeling in/out.
fn.hoist_get_reel_distance:ft V2 Distance that the reel is extended, also supports :m
fn.hoist_get_distance_from_ground:ft V2 Distance from the hoist object to the ground, also supports :m

Hoist SDK Variables

L:Var Remarks
L:H145_SDK_HOIST_MODE 0: auto, 1: manual
L:H145_SDK_HOIST_CONTROL manual control signal
L:H145_SDK_HOIST_CABLE_FT Distance that the reel is extended
L:H145_SDK_EQUIP_HOIST 0: not installed, 1: installed
L:H145_SDK_OH_HOIST Overhead switch position (and arm position)

Hoist SDK Events

L:Event Remarks
H:H145_SDK_EQUIP_HOIST_ON Equipment Setup - Hoist ON
H:H145_SDK_EQUIP_HOIST_OFF Equipment Setup - Hoist OFF
H:H145_SDK_EQUIP_HOIST_TOGGLE Equipment Setup - Hoist TOGGLE
H:H145_SDK_HOIST_CONTROL_MODE_AUTO Hoist - Hoist Mode AUTO
H:H145_SDK_HOIST_CONTROL_MODE_MANUAL Hoist - Hoist Mode MANUAL
H:H145_SDK_HOIST_CONTROL_MOTOR_UP Hoist - Hoist Manual Control UP
H:H145_SDK_HOIST_CONTROL_MOTOR_STOP Hoist - Hoist Manual Control STOP
H:H145_SDK_HOIST_CONTROL_MOTOR_DOWN Hoist - Hoist Manual Control DOWN
H:H145_SDK_HOIST_CONTROL_MOTOR_MOMENTARY_UP Hoist - Hoist Manual Control MOMENTARY_UP
H:H145_SDK_HOIST_CONTROL_MOTOR_MOMENTARY_DOWN Hoist - Hoist Manual Control MOMENTARY_DOWN
H:H145_SDK_HOIST_ARM_STOW Hoist - Hoist Arm STOW
H:H145_SDK_HOIST_ARM_DEPLOY Hoist - Hoist Arm DEPLOY
H:H145_SDK_HOIST_EASY_STOWED Hoist - Select Stowed
H:H145_SDK_HOIST_EASY_DEPLOYED Hoist - Select Deployed
H:H145_SDK_HOIST_EASY_CREW Hoist - Select Crew
H:H145_SDK_HOIST_EASY_WORKER Hoist - Select Worker
H:H145_SDK_HOIST_EASY_STRETCHER_ANDCREW Hoist - Select Stetcher_And_Crew
H:H145_SDK_HOIST_EASY_SURVIVOR1_ANDCREW Hoist - Select Survivor_1_And_Crew
H:H145_SDK_HOIST_EASY_SURVIVOR2_ANDCREW Hoist - Select Survivor_2_And_Crew
H:H145_SDK_HOIST_EASY_TOOLBAG Hoist - Select Toolbag
H:H145_SDK_HOIST_EASY_CONTAINERS Hoist - Select Containers
H:H145_SDK_HOIST_EASY_HOSE Hoist - Select Hose

# Hoist test program

{
  "title": "Hoist Test Program",
  "author":"davux3",
  "api_version": 0.1,
  "aircraft": ["H145"],
  "briefing":[
    {"text":"Extended length: {0} ft", "params":[ {"tofixed":{"fn":"hoist_get_reel_distance:ft"}, "digits":2} ]},
    {"text":"Aircraft distance to ground: {0} ft", "params":[ {"tofixed":{"subtract":[{"var":["RADIO HEIGHT", "feet"]}, 5.45]}, "digits":2} ]},
    {"text":"Hoist distance to ground: {0} ft", "params":[ {"tofixed":{"fn":"hoist_get_distance_from_ground:ft"}, "digits":2} ]},
    {"buttonbar":[
      {"title":"Retract", "commands":[ {"hoist_control":"reel_up", "speed":{"scale":[{"local":"speed_slider"}, 0, 100, 0.01, 2]}} ]},
      {"title":"Extend", "commands":[ {"hoist_control":"reel_down", "speed":{"scale":[{"local":"speed_slider"}, 0, 100, 0.01, 2]}} ]}
    ]},
    {"text":"Motor speed factor:"},
    {"slider":{ "min":0, "max":100, "local":"speed_slider" }}
  ],
  "objectives": [
    {
      "title": "Done",
      "commands": [
        {"set":{"local":"speed_slider"},"value":10},
        {"sleep": "forever"}
      ]
    }
  ]
}