Skip to content

Commit

Permalink
Added FA-18C Hornet backlight control
Browse files Browse the repository at this point in the history
  • Loading branch information
iknowkungfutoo committed Dec 2, 2023
1 parent 7e728d1 commit bb0eec3
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 12 deletions.
7 changes: 4 additions & 3 deletions TMHotasLEDSync.tmc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-- various lamps and console lighting of a variety of aircraft.
--
-- Author: slughead
-- Date: 26/11/2023
-- Date: 2/12/2023
--
------------------------------------------------------------------------------*/

Expand All @@ -20,8 +20,9 @@ include "aircraft_utils.tmh"
include "led_utils.tmh"
include "a-10c_led_utils.tmh"
include "f-16c_led_utils.tmh"
include "fa-18c_hornet_led_utils.tmh"

define VERSION "1.0.2"
define VERSION "1.0.3"

define DEBUG 0

Expand Down Expand Up @@ -116,7 +117,7 @@ int TCPCallback(int buf, int size)
if (aircraft == F_16C_50) set_f_16c_led_status( &packet );
if (aircraft == A_10C) set_a_10c_led_status( &packet );
if (aircraft == A_10C_2) set_a_10c_led_status( &packet );
if (aircraft == FA_18C_HORNET) set_speed_brake_leds( char_to_int(packet[1]) );
if (aircraft == FA_18C_HORNET) set_fa_18c_hornet_led_status( &packet );
if (aircraft == SU_25T) set_speed_brake_leds( char_to_int(packet[1]) );
if (aircraft == SU_33) set_speed_brake_leds( char_to_int(packet[1]) );
}
Expand Down
11 changes: 4 additions & 7 deletions a-10c_led_utils.tmh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- on Thrustmaster Warthog Throttle.
--
-- Author: slughead
-- Date: 26/11/2023
-- Date: 2/12/2023
--
------------------------------------------------------------------------------*/

Expand All @@ -23,7 +23,7 @@ int set_a_10c_led_status( alias led_states )
if (&Throttle != &joy0)
{
set_a_10c_speed_brake_leds( speed_brake_position );
set_backlight(&Throttle, console_light);
set_a_10c_backlight( console_light) ;
}
}

Expand All @@ -39,10 +39,7 @@ int set_a_10c_speed_brake_leds(int speed_brake_position)
}
}

int set_backlight(int device, int intensity)
int set_a_10c_backlight( int intensity )
{
if (device == &Throttle)
{
ActKey(PULSE+KEYON+LED(device, LED_INTENSITY, intensity * 51));
}
set_backlight( intensity );
}
46 changes: 46 additions & 0 deletions fa-18c_hornet_led_utils.tmh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*-------------------------------------------------------------------------------
--
-- fa-18c_hornet_led_utils.tmh
--
-- Use at own risk without warranty.
--
-- F/A-18C Hornet specific utility functions to program the state of LEDs
-- on Thrustmaster Warthog Throttle.
--
-- Author: slughead
-- Date: 2/12/2023
--
------------------------------------------------------------------------------*/

//include "warthog_defines.tmh"
//include "warthog_utils.tmh"

int set_fa_18c_hornet_led_status( alias led_states )
{
int speed_brake_position = char_to_int(led_states[1]);
int console_light = char_to_int(led_states[2]);

if (&Throttle != &joy0)
{
set_fa_18c_speed_brake_leds( speed_brake_position );
set_fa_18c_hornet_backlight( console_light) ;
}
}

int set_fa_18c_speed_brake_leds(int speed_brake_position)
{
if (&Throttle != &joy0)
{
set_led(&Throttle, get_tm_warthog_led_id( WH_LED1 ), (speed_brake_position >= 1));
set_led(&Throttle, get_tm_warthog_led_id( WH_LED2 ), (speed_brake_position >= 2));
set_led(&Throttle, get_tm_warthog_led_id( WH_LED3 ), (speed_brake_position >= 3));
set_led(&Throttle, get_tm_warthog_led_id( WH_LED4 ), (speed_brake_position >= 4));
set_led(&Throttle, get_tm_warthog_led_id( WH_LED5 ), (speed_brake_position >= 5));
}
}

int set_fa_18c_hornet_backlight( int intensity )
{
set_backlight( intensity );
//ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, intensity * 51));
}
9 changes: 7 additions & 2 deletions led_utils.tmh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- and Warthog devices.
--
-- Author: slughead
-- Date: 26/11/2023
-- Date: 2/12/2023
--
------------------------------------------------------------------------------*/

Expand Down Expand Up @@ -74,10 +74,15 @@ int reset_leds()
set_led(&Throttle, get_tm_warthog_led_id( WH_LED4 ), LED_STATE_OFF);
set_led(&Throttle, get_tm_warthog_led_id( WH_LED5 ), LED_STATE_OFF);

set_backlight(&Throttle, 3);
set_backlight( 3 );
}
}

int set_backlight( int intensity )
{
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, intensity * 51));
}

int set_speed_brake_leds(int speed_brake_position)
{
if ( aircraft == FA_18C_HORNET |
Expand Down

0 comments on commit bb0eec3

Please sign in to comment.