This post is a repost of a blog entry from 13th September 2015 on Kerbal Space Program forum (soon to be defunct).
Most of the modules of the K-42 are simple collections of switches that
use almost identical software. In fact almost all modules share the same
code base with only a a few tweaks were needed. If you've already taken
a look at the code for the joystick module, you will find that a lot of
the structure is the same as that in the code for the modules I present
here, especially the Flight control module that also have an analog
axis.
Flight control module
This module contains the throttle control, staging and some
controls that are nice to have close at hand while landing or launching.
The arming switch is a bit different from the other switches as some of
its function is hard coded in the module: The Stage and Abort buttons
does not work (and cannot be read at all) unless the safety is switched
to "Arm". The switch is otherwise a normal switch so it's possible to
use it as an arming switch for other pyro functions, e.g parachutes.
The buttons have no covers, but they are actually foot controls with a
heavy spring and really distinct click resistance. I guess the pressure
to activate is around 4 or 5 pounds so they are really hard to activate
by mistake even if the system is armed.
Source code:
https://drive.google.com/file/d/0B5F...ew?usp=sharing
Power and Communication module
Not much to say about this one. As for all modules that have switches
that cannot be implemented by mapping them to a funktion supported by
KSP_Serial_IO they will instead be mapped to keyboard sequences using
Action Groups Extended. The main breaker may seem unnecessary, but it's
there so I can switch off and on the keyboard mapping when I change
focus to other programs (who may behave badly if the control panel sends
them key sequences). When switched on the panel sends key commands for
ALL switches mapped to key controls to ensure that the state of the
craft is synced to the switch settings (which is REALLY annoying if I
swith the panel on while editing in the Arduino IDE... :-P ).
Source code: https://drive.google.com/file/d/0B5F...ew?usp=sharing
Engine and Chute module
I made a mistake when soldering this module. I had accidentally turned
the module upside down on the table and soldered the wrong terminal of
the switches to the signal wires. This means that the switches pull the
Arduino inputs to ground in the down position instead of the up
position. It doesn't matter much in the end as all I had to do was to
negate the input signal when reading switch positions.
Source code: https://drive.google.com/file/d/0B5F...ew?usp=sharing
Mission Specific module
The cryptic title actually means that this is the panel that controls
the actions groups of KSP. They are intended for activating non-generic
functions such as drills and refinery equipment that may only be found
on special missions.
As you may notice there are only switches for AG1-4. This is because I
reserved AG5-10 for parts that only have a toggle action, as I have no
way of detecting which state a toggled part is in unless I control it
from an action group with KSP_Serial_IO.
AG11-14 will be implemented by keyboard commands and Action Groups
Extended. There will be one action for the up position and another for
the down position of each switch.
Source code: https://drive.google.com/file/d/0B5F...ew?usp=sharing
No comments:
Post a Comment