SonicCruiser_icon.jpgOk, So here we are again. The RSS has raised it's head one last time.. This time we will slay it.. So onward and upward. 


First I have talked about this part of the puzzle more than a few times.. Well spurned on by my CDU_IOP, I thought that since the CDU_IOP was designed with modularity in mind I rewrote my RSS_IOP to take advantages of things that I have learnt along the way.

 

CODE SEGMENTS: First we have to talk about the model or the structure of the radios.

 

rss.hadd a few radiosOur main.c

struct rss_s {

    char * device_info;

    char * device_model;

    char * device_serial;

    int power_48v;

    int power_400hz;

    int panel_lamps;

    void * radio_info;

    int sub_devices;

    int panel_lamp;

    struct device_s {

        int fd[ FD_pair ];

        int frequency[ tuned ];

        int dial_lamp;

}sub_device[];

}

struct radio_G3713 {

  int sw_VHF_NAV;

  int sw_VOR_TEST;

  int sw_DME_TEST;

  int sw_DME_STBY;

  int sw_UP;

  int sw_DOWN;

  int vhf_dial_lamp;

  int nav_dial_lamp;

}

 

struct radio_G3490 {

  int sw_com1_test;

  int sw_com2_test;

  int sw_nav1_test;

  int sw_nav2_test;

  int sw_comm_sel;

  int led_nav1;

  int led_nav2;

  int dial_lamp_com1;

  int dial_lamp_com2A;

  int dial_lamp_com2B;

  int dial_lamp_nav1;

  int dial_lamp_nav2;

};

int main(int argc, char *argv[]){

 

    max_fd = 0;

    int ecode;

 

    static struct radio_G3713 G_3713;

    static struct radio_G3490 G_3490;

 

    static struct rss_s radios[] = {

      { "COM/NAV #1", "G-3717", "81",  0, 0, 0, & G_3713,  2, },

      { "5in1", "G-3490", "31",  0, 0, 0, & G_3490,  4, },

    };

 

 

    int i, j;

  // loop over the installed Radios and sub radios

    for( i = 0; i < DIM( radios ); i++ ){ // RADIOS

      for ( j = 0; j < radios[i].sub_devices; j++  ) { // SUB DEVICES

          if( init( radios[i].sub_device[j] ) == ERROR ){

            perror( "Initialization failed");

            return( ERROR );

      }}}

 

    do{

  // test for power errors

  /*if (( p400 = power_buss_400hz()) || ( p48 = power__buss_48v() != OFF )) {

    if( !p400 ){

    error_msg() }

  } */

 

  // iop retruns with error TBD!!

  }  while( ecode != ERROR );

}

 

You will notice that in rss_s structure is an array, and each array member is a radio, and each radio can have 'sub devices' that is one or more tuner(s). Lastly in the rss.h there is a pointer to radio_info but its a void type (this is a place holder only and we will have to cast it to one of the radios in column two).

G-3717.jpg

Gables G-3713

Fig 1.

Well as you can see in Fig 1. and they looking at struct radio_G3713, you will notice a one to one instance between a switch and its description in the code segments. For instance if you look a Fig 1. and see the 'DME TEST' push button, in the lower right, and you see in the code above 'int sw_DME_TEST;' This is the same for every switch on the radio. The frequency dial is handled by ARINC-410 code which is a 2 out of 5 negative going code.







    Keep tuned in more to come

  ~ Cris

 

 

 

3/30/2114 Major changes to the rss data structures.

  1. removed this from rss.s: and added it to all of the  radio_ xxxxxx structure(s).
    struct device_s
            int fd[ FD_pair ];
            int frequency[ tuned ]
          int dial_lamp;}sub_device[];
  2. In main.c the second for loop has been eliminated.
    for ( j = 0; j < radios[i].sub_devices; j++  ) { // SUB DEVICES
  3. This also changes the next line of code from:
    if( init( radios[i].sub_device[j] ) == ERROR ){
    to:
    if( rss_init( radios[i] ) == ERROR ){