Difference between revisions of "FG Int Objects Modules"

From FlightGear wiki
Jump to: navigation, search
m (Radio Panel main configuration update)
m (fix: Template:FG Int Objects Modules sidebar can after the move to the template namespace be transcluded like a regular template)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{:FG Int Objects Modules sidebar}}
+
{{FG Int Objects Modules sidebar}}
 
Modules in FG interface are Object Class , as like a map, to build a new object. You have learned about '''HT16K33''' and '''MCP23017''' classes, they are Modules, special Modules named in FG Interface world '''Devices'''. I made this difference to split and make the difference between switch , displays .. etc and the hardware driver chip.<br />
 
Modules in FG interface are Object Class , as like a map, to build a new object. You have learned about '''HT16K33''' and '''MCP23017''' classes, they are Modules, special Modules named in FG Interface world '''Devices'''. I made this difference to split and make the difference between switch , displays .. etc and the hardware driver chip.<br />
 
All Modules Classes are loaded into the interface, ready to be used and can be requested with the '''getModule()''' Interface Method.
 
All Modules Classes are loaded into the interface, ready to be used and can be requested with the '''getModule()''' Interface Method.
Line 28: Line 28:
  
 
In the '''MODULES''' section, you can see all modules that will be loaded.
 
In the '''MODULES''' section, you can see all modules that will be loaded.
Here We are loading '''HT16K33''' from module file '''FGIntHT16K33.py'''. Same thing for the '''MCP23017''' Module in the '''FGIntMCP23017.py''' and '''FGIntSegDisplay.py''' with the '''SegDisplay''' Class
+
Here We are loading '''HT16K33''' from module file '''FGIntHT16K33.py'''. Same thing for the '''MCP23017''' Module in the '''FGIntMCP23017.py''', '''FGIntSegDisplay.py''' with the '''SegDisplay''' Class
  
 
Some Module file can handle more than one Class, as like '''FGIntSwitch.py''' where you can find different Class for different switch types.
 
Some Module file can handle more than one Class, as like '''FGIntSwitch.py''' where you can find different Class for different switch types.
Line 37: Line 37:
 
* '''ToogleSwitch''' : Single Push button that will switch between 2 states at each push
 
* '''ToogleSwitch''' : Single Push button that will switch between 2 states at each push
  
 
+
[[Category:FG Interface]]
As the radio panel had lots of push button, we need to load the '''ToogleSwitch''' Class.<br />
+
We add it to the configuration file.
+
<syntaxhighlight lang="ini">
+
[INT]
+
intname=RADIOPANEL
+
deviceconf=/opt/fgint/Config/devices.cfg
+
 
+
[MODULES]
+
module01=FGIntHT16K33,HT16K33
+
module02=FGIntMCP23017,MCP23017
+
module03=FGIntSegDisplay,SegDisplay
+
module04=FGIntSwitch,Switch
+
module04=FGIntSwitch,ToogleSwitch
+
 
+
[AUXCONF]
+
displays=/opt/fgint/Config/displays.cfg
+
switches=/opt/fgint/Config/switches.cfg
+
</syntaxhighlight>
+

Latest revision as of 07:11, 12 April 2020

Modules in FG interface are Object Class , as like a map, to build a new object. You have learned about HT16K33 and MCP23017 classes, they are Modules, special Modules named in FG Interface world Devices. I made this difference to split and make the difference between switch , displays .. etc and the hardware driver chip.
All Modules Classes are loaded into the interface, ready to be used and can be requested with the getModule() Interface Method.

To be loaded, the module need to be declared. For memory, the main config file :

[INT]
intname=RADIOPANEL
deviceconf=/opt/fgint/Config/RadioPanel/devices.cfg

[MODULES]
module01=FGIntHT16K33,HT16K33
module02=FGIntMCP23017,MCP23017
module03=FGIntSegDisplay,SegDisplay
module04=FGIntSwDisplay,SwitchLight
module05=FGIntSwitch,Switch
module06=FGIntSwitch,ToogleSwitch
module07=RotaryEncoder,RotaryEncoder

[AUXCONF]
displays=/opt/fgint/Config/RadioPanel/displays.cfg
swlights=/opt/fgint/Config/RadioPanel/swlights.cfg
switches=/opt/fgint/Config/RadioPanel/switches.cfg
tglswitches=/opt/fgint/Config/RadioPanel/tglswitches.cfg
encoders=/opt/fgint/Config/RadioPanel/rotenc.cfg

In the MODULES section, you can see all modules that will be loaded. Here We are loading HT16K33 from module file FGIntHT16K33.py. Same thing for the MCP23017 Module in the FGIntMCP23017.py, FGIntSegDisplay.py with the SegDisplay Class

Some Module file can handle more than one Class, as like FGIntSwitch.py where you can find different Class for different switch types. FGIntSwitch.py own the folling classes :

  • Switch : Single switch 2 states
  • DoubleSwitch : Single switch 3 states
  • RotarySwitch : Use to manage a rotary switch (variable nb position)
  • ToogleSwitch : Single Push button that will switch between 2 states at each push