diff --git a/Simulator/Main/3dfx.sh b/Simulator/Main/3dfx.sh index cb766b743..2a310ebf7 100755 --- a/Simulator/Main/3dfx.sh +++ b/Simulator/Main/3dfx.sh @@ -1,6 +1,14 @@ #!/bin/sh -WINDOW=YES +if [ $1 = "--full" ]; then + echo "Running full screen ..." + shift + WINDOW=NO +else + echo "Running in a window, use --full to run full screen." + WINDOW=YES +fi +echo if [ $WINDOW = "YES" ]; then # in a window (slow hack) diff --git a/Simulator/Main/Makefile.am b/Simulator/Main/Makefile.am index ca71378e2..3d5a51361 100644 --- a/Simulator/Main/Makefile.am +++ b/Simulator/Main/Makefile.am @@ -27,7 +27,7 @@ else SERIAL_LIBS = endif -EXTRA_DIST = runfgfs.in runfgfs.bat.in +EXTRA_DIST = 3dfx.sh runfgfs.in runfgfs.bat.in bin_PROGRAMS = fgfs diff --git a/Simulator/Main/fg_serial.cxx b/Simulator/Main/fg_serial.cxx index 0c14b78db..fef2c32d5 100644 --- a/Simulator/Main/fg_serial.cxx +++ b/Simulator/Main/fg_serial.cxx @@ -478,28 +478,30 @@ static void send_rul_out( fgIOCHANNEL *p ) { // get roll and pitch, convert to degrees double roll_deg = f->get_Phi() * RAD_TO_DEG; - while ( roll_deg < 0.0 ) { + while ( roll_deg < -180.0 ) { roll_deg += 360.0; } - while ( roll_deg > 360.0 ) { + while ( roll_deg > 180.0 ) { roll_deg -= 360.0; } double pitch_deg = f->get_Theta() * RAD_TO_DEG; - while ( pitch_deg < 0.0 ) { + while ( pitch_deg < -180.0 ) { pitch_deg += 360.0; } - while ( pitch_deg > 360.0 ) { + while ( pitch_deg > 180.0 ) { pitch_deg -= 360.0; } // scale roll and pitch to output format (1 - 255) - int roll = (int)(roll_deg * 254.0 / 359.0) + 1; - int pitch = (int)(pitch_deg * 254.0 / 359.0) + 1; + // straight && level == (128, 128) + + int roll = (int)( (roll_deg+180.0) * 255.0 / 360.0) + 1; + int pitch = (int)( (pitch_deg+180.0) * 255.0 / 360.0) + 1; sprintf( rul, "p%c%c\n", roll, pitch); - FG_LOG( FG_SERIAL, FG_DEBUG, "p " << roll << " " << pitch ); + FG_LOG( FG_SERIAL, FG_INFO, "p " << roll << " " << pitch ); string rul_sentence = rul; p->port.write_port(rul_sentence); diff --git a/Simulator/Main/runfgfs.bat.in b/Simulator/Main/runfgfs.bat.in index e64c4b637..ebcc4988f 100755 --- a/Simulator/Main/runfgfs.bat.in +++ b/Simulator/Main/runfgfs.bat.in @@ -1,28 +1,23 @@ REM @ECHO OFF -REM Skip ahead to RUN1 if %FG_ROOT%\BIN\FGFS.EXE exists -IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1 +REM Skip ahead to CONT1 if FG_ROOT has a value +IF NOT %FG_ROOT%.==. GOTO CONT1 -REM %FG_ROOT% wasn't set right so let's try "." SET FG_ROOT=. -IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1 -REM %FG_ROOT% wasn't set right so let's try ".." -SET FG_ROOT=.. -IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1 +:CONT1 -REM %FG_ROOT% wasn't set right so let's try "@prefix@" -SET FG_ROOT=@prefix@ -IF EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO RUN1 +REM Check for the existance of the executable +IF NOT EXIST %FG_ROOT%\BIN\FGFS.EXE GOTO ERROR1 -ECHO Cannot find %FG_ROOT%\BIN\FGFS.EXE -GOTO END - -:RUN1 REM Now that FG_ROOT has been set, run the program ECHO FG_ROOT = %FG_ROOT% %FG_ROOT%\BIN\FGFS.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9 GOTO END +:ERROR1 +ECHO Cannot find %FG_ROOT%\BIN\FGFS.EXE +GOTO END + :END