Cockpit

* User Profile

Welcome, Guest. Please login or register.

Login with username, password and session length

Who's Online

  • *Users: 2
  • *Guests: 18
  • *Total: 20

Our Discord

Author Topic: Scott (and Rob's...) Chicago 737-300 Build  (Read 29915 times)

Offline Ed

  • Forum GURU
  • *
  • Posts: 186
  • Karma: +2/-0
  • Aviation Enthusiast
    • My 737NGX800 Homebuilt Cockpit
  • First Name: Edwin
  • Home Location: Marathon, Ontario, Canada
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #125 on: January 21, 2018, 07:48:33 AM »
New video...

Enjoying a little XEnviro weather flying a circuit at KSEA.....all running smooth and looking phenomenal.

https://youtu.be/QTs4n1mpq34

733....slowly but surely coming along...

Scott

Great Video Scott. Very smooth. Huge wow factor !
Ed
FSX-SE,P3D4,W10-I7@4.8,W7-i7 920 ,W10-Dual Core@2.66.,FSUIPC 4 + 5,WideFS.Prosim737,JSV2,ASN, ,Vpilot,GSX,Pro-ATC/X,RAAS Pro,UT2,PFPX,TopCat,Accu-Feel
http://www.737ngxca.com/

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #126 on: January 30, 2018, 01:12:17 PM »
Decided to fire up my back two displays again networked on XP.    Installed XEnviro on them and working great.   not always perfect because the clouds are not synced perfectly across networked visuals but good enough for me......and Immersion well.....IMHO beats the hell out of projectors.   But beauty is in the eye of the beholder.   You have to be in it and see it believe me.   All are welcome to visit.

https://youtu.be/Tm7waOeZB0s

https://youtu.be/h9iNzqmg8kY


Offline Bob Reed

  • Administrator
  • I am chained to this website!
  • *
  • Posts: 2,345
  • Karma: +11/-0
  • Bob the Builder!
  • First Name: Bob
  • Home Location: Holley, New York
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #127 on: January 30, 2018, 02:45:34 PM »
The entire sim is amazing! Great work!

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #128 on: March 02, 2018, 08:15:26 PM »
All MIP Korries, Master Caution, Fire Warning, and Six Packs interfaced and working...check. (Lights test looks like XMAS!)

Pressurization panel interfaced and working...check



Offline Steenos

  • Forum GURU
  • *
  • Posts: 85
  • Karma: +1/-1
  • Aviation Enthusiast
  • First Name: Justin
  • Home Location: KCHA
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #129 on: March 02, 2018, 09:07:56 PM »
All MIP Korries, Master Caution, Fire Warning, and Six Packs interfaced and working...check. (Lights test looks like XMAS!)

Pressurization panel interfaced and working...check

Looks awesome Scott!

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #130 on: March 04, 2018, 09:20:05 PM »
Worked on my Windshield/Pitot Heat panel this weekend.   Have to finish my Teensy sketch and will be working by tomorrow night.   Here are some pictures of interfacing the real panel and how it wires into a Teensy using Rob’s breakout board with some ULN2803s and a Teensy LC.

Scott

Offline jackpilot

  • Moderator
  • I am chained to this website!
  • *
  • Posts: 3,987
  • Karma: +38/-0
  • 737-800 Sim-Avionics/Full Cockpit FDS + OEM P3D V4
  • First Name: Jack
  • Home Location: Montreal / Canada
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #131 on: March 04, 2018, 10:02:55 PM »
You Guys are real 73-Nuts !!!!   :D

Keep on !


Jack

Offline blueskydriver

  • I am chained to this website!
  • *
  • Posts: 1,707
  • Karma: +4/-2
  • FSX/FS9 PM, PMDG737-700, FDSMIP/Overhead.etc
  • First Name: John
  • Home Location: WI
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #132 on: March 05, 2018, 02:20:09 AM »
Hey Rob and Scott,

My curiosity into using Teensy cards is getting stronger every time you guys post something new, and now seeing the PCB's that Rob has developed is making things that much easier. So, Rob are you planning on selling these in a kit and/or as P&P in the future?

Next, Rob I know you did the B727 in the past, but could it be done using Teensy's along with your PCB (and other needed items)? Also, what language/software (interface) are you using to set everything up? In other words, I know zilch about the methodology involved with the setups Scott and you are doing; however, I surely could learn, but mainly for the 72 as well as the 73.

Likely, you're wondering where I am going with this line of questioning...well; if do not sell my 72 I might decide to keep it and get it working. After all the time and effort just acquiring it, plus seeing it sitting here next to me everyday just looking pretty makes it a whole lot harder to part with her. Actually, sitting here in the hanger everyday is just as bad, if only I had you guys closer I could just imagine what we could do.

Heck, any other members living closer would be a blessing, but that is not in the foreseeable future, not unless I convince Bob and his wife to move near me...come on Bob...just keep saying Tomah, WI, Tomah, WI...lol! Everyone else you're welcome to come visit or move to Tomah, WI and join me. I really do need a partner or two, as my past ones developed medical issues; one with survivable Prostate Cancer and the other passed away due to Colon Cancer.

Uh, no I am not bad luck or anything...lol...but then again who else just had surgery?
Makes you wonder... :huh:...hahahaha...but then again, can you say;

"Things that make you go hmmmm?!"

https://www.youtube.com/watch?v=XF2ayWcJfxo

Did you enjoy the retro?

John

   
« Last Edit: March 05, 2018, 02:21:36 AM by blueskydriver »
| FSX | FDS-MIP OVRHD SYS CARDS FC1| PM | PMDG 737-700 | UTX | GEX | UT7 | ASE | REX2 | AES | TSR | IS | TOPCAT | AvilaSoft EFB | OC CARDS & OVRHD GAUGES| SIMKITS | SW 3D Lights | FS2CREW2010 | FSXPassengers | Flight1 AE | MATROX TH2GO-D | NTHUSIM | 3-Mits EW230Ust Proj |

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #133 on: March 05, 2018, 07:20:39 AM »
John,
The 727 could EASILY be done using Teensy interfacing the same as we are doing here.  In fact, I could quite easily switch mine back to a 737-200 if I chose with a few panel changes.   For a 727 you would want to use X-Plane and the incredible awesome FlyJSim 727 aircraft addon.  Jack (the main developer of FlyJSim) is updating the 727 to version 3 as we speak just like he just did for his incredible 732.   He exposes all of the systems via datarefs and my guess is the 727 would be near if not 100 percent interfaceable the same as Rob and I have done ours.   See Jack continue developement of the new version on his Twitch channel.   My guess is it will be completed within the next month or two but you could use the existing version until then just fine.   It would be really something for you or someone to build that 727.    Rob and I would be hapoy to help with coding questions and such.   May even be able to take a trip there at some point.   You have to come pay a visit to me in April when I am back from Spring vacation.

As for the coding, it is simple C# Arduino ccoding but Teensy’s offer a unique flightsim library and plug in for XPlane and very powerful performance for a very low cost.   What is also cool about Teensys and Arduino is that the code (sketch) is self contained on the Interface once you load it and a simple plugin in XPlane allows the communication.    You can unplug one of these or reload it on the fly and do not have to restart the sim.   You can do this in flight!   Makes testing really slick and easy.

I will post my Sketch for the Windshield Heat panel later today or tonight when I finish it and you can see how simple.

Build that 727 John!  If I had the space I would buy it from you in a heart beat and build it myself!

Scott

Offline kurt-olsson

  • I spend way too much on this forum!
  • *
  • Posts: 972
  • Karma: +0/-0
  • 737 -mixed year OEM panel builder.
  • First Name: Peter
  • Home Location: Gothenburg
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #134 on: March 05, 2018, 09:46:12 AM »
That panel interface is looking awesome. What awg you using for 5v,28v and ground? What is your connector called and what tool to press it?

Offline 727737Nut

  • I spend way too much on this forum!
  • *
  • Posts: 916
  • Karma: +2/-0
  • 737-300 Using Real parts and X-Plane 10
  • First Name: Rob Archer
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #135 on: March 05, 2018, 10:21:50 AM »
That panel interface is looking awesome. What awg you using for 5v,28v and ground? What is your connector called and what tool to press it?

Kurt,
The wire AWG is all dependent on the circuit load and as the case with most simbuilders, we go way overboard.  LOL     For real Korry's, they draw 70 - 80mA per bulb so roughly 150mA per Korry.  So from the Korry to Teensy board 26ga would be plenty, same for the switch signal inputs.   Now for the wire to feed the 28v and GND to the module as a whole lets use this panel Scott built as an example.  17 Korry's so that 17x 150mA = 2550mA or 2.5A   So to feed that panel you would only need 18ga  wire.  Now for the entire overhead while on a Lights test, you would calculate total load and use the appropriate sized wire for that load.  NOTE! when calculating wire size you must know the distance of the run to and from the power supply. So if your 28V power supply is sitting 20ft away form the supply terminal strips in the overhead, you would need to use 40ft as total run distance and lets say 10A  So you would need a 12ga feed wire from your power supply to the overhead.   Make sense?   As for connectors, Scot uses Amp brand connectors, I used automotive style connectors I got from amazon.  Doesn't matter what you use as long as you get a properly rated connector for the amp draw.   These are overkill that we use but easier to handle with average hands and more robust than smaller connectors.

One day we can discuss how I only have 3 wires  to mine as well but in my case the Ground is also DC and AC gnd as all my backlighting is 0-5Vac.   ;)      Scotts 3 wires are 28Vdc, 0-5Vdc, and GND   Mine are 28Vdc, 0-5Vac, and GND plus one usb connection.   It has proven to be a very nice, robust, and most of all convenient to remove for updates/repairs/maint.

Rob
737 Junkie

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #136 on: March 05, 2018, 10:23:58 AM »
That panel interface is looking awesome. What awg you using for 5v,28v and ground? What is your connector called and what tool to press it?
Thanks Rob, and for a little further on mine...

The wires going to the Teensy are 22 awg (24-26 would be fine as well but i like 22 for added measure and ease of using various connectors).  Gray wire is for ground signal on korrys back through ULN2803 chips (defined as outputs on the Teensy.    White wires are input wires going from switches to the Teensy.     Red wire (with white strip or white heat shrink) is noted as 5vdc backlighting power which is variable with dimmers.   Purple in my cockpit is 28vdc.   The thicker Red, Purple, and Black wires going into the Molex connector is 16 awg.   I use 16 awg as feeders into all panels.   those feeders go to my Blue Ocean Busses and all feeders have appropriate fuses.     The blue ocean busses connect back to my rack and to the appropriate power supplies via 12 awg wire and on regular aircraft style breakers.   

The molex connectors are by Waldom and are the .093 size for 16 gauge wires.  .062 for smaller 22-24 awg wire. You can buy the crimper from them as well as a tool used to extract pins once installed.  I get them from Digikey.

https://www.digikey.com/product-detail/en/molex-connector-corporation/76650-0058/WM8355-ND/2115919
« Last Edit: March 05, 2018, 10:28:10 AM by XOrionFE »

Offline kurt-olsson

  • I spend way too much on this forum!
  • *
  • Posts: 972
  • Karma: +0/-0
  • 737 -mixed year OEM panel builder.
  • First Name: Peter
  • Home Location: Gothenburg
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #137 on: March 05, 2018, 11:25:09 AM »
Thanks! Will have a good strategy and proper tools before i start my interface-fest! :)

Offline fsaviator

  • I am chained to this website!
  • *
  • Posts: 1,274
  • Karma: +2/-0
  • Aviation Enthusiast
    • Boeing 737 Next Generation Simulator
  • First Name: Warren
  • Home Location: Riverview, Florida
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #138 on: March 05, 2018, 08:42:57 PM »
It would be nice to see some of this information captured in it's own space with part #s.....  My bookmark list is getting kind of large.  So is the pile of parts, chips, PCBs and all for me to tackle teensy.  I need to retire.  This work thing is interfering with my simming
Warren "MTN385"
Florida

http://www.B737NG-SIM.com and https://www.facebook.com/fsaviator on facebook
FSX, Prosim737 Suite, FDS DSTD 2.0 MIP, RevSim Proline TQ, ACE Dual-linked Yokes, Intel 3.5GHz i7-3770K, MSI Z77A-G45, 16GB G.Skill TridentX DDR3-2400, Galaxy GTX670 GC 4GB, OCZ 60GB Vertex 3

Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #139 on: March 05, 2018, 08:45:23 PM »
Here is the Teensy sketch for my Window/Heat panel:

Scott



------Begin-----
#include <Arduino.h>
#include <Bounce.h>

//IXEGWindowHeat Panels using TeensyLC

// output pins
const uint8_t WIN_OVHT_LEFT_SIDE_LT_PIN = 0;
const uint8_t WIN_OFF_LEFT_SIDE_LT_PIN = 1;
const uint8_t WIN_OVHT_LEFT_FWD_LT_PIN = 2;
const uint8_t WIN_OFF_LEFT_FWD_LT_PIN = 3;
const uint8_t WIN_OVHT_RIGHT_FWD_LT_PIN = 4;
const uint8_t WIN_OFF_RIGHT_FWD_LT_PIN = 5;
const uint8_t WIN_OVHT_RIGHT_SIDE_LT_PIN = 6;
const uint8_t WIN_OFF_RIGHT_SIDE_LT_PIN = 7;
const uint8_t CAPT1_AUX_LT_PIN = 8;
const uint8_t FO_2_STAT_LT_PIN = 9;
const uint8_t LEFT_ELEV_PITOT_LT_PIN = 10;
const uint8_t LEFT_ALPHA_VANE_LT_PIN = 11;
const uint8_t TEMP_PROBE_LT_PIN = 12;
const uint8_t FO_2_AUX_LT_PIN = 13;
const uint8_t CAPT_STAT1_LT_PIN = 14;
const uint8_t RIGHT_ELEV_PITOT_LT_PIN =15;
//const uint8_t RIGHT_ALPHA_VANE_LT_PIN  *Note that the Right Alpha Vane Korry is on a separate Teensy*
const uint8_t WINHEAT_LEFT_SIDE_SW_PIN = 16;
const uint8_t WINHEAT_LEFT_FWD_SW_PIN = 17;
const uint8_t WINHEAT_RIGHT_SIDE_SW_PIN = 21;
const uint8_t WINHEAT_RIGHT_FWD_SW_PIN = 20;
const uint8_t PITOT_A_SW_PIN = 22;
const uint8_t PITOT_B_SW_PIN = 23;
const uint8_t WINHEAT_TEST_SW_PIN = 18;
const uint8_t WIN_PWR_TEST_SW_PIN = 19;

const int BOUNCE_TIME = 15;// Switch debouncing time (used for all switches)

const float LIGHT_THRESHOLD = 0.2; // threshold to use for light on or off

//define dataRef vars

FlightSimFloat winovhtleftsideannXref;
FlightSimFloat winoffleftsideannXref;
FlightSimFloat winovhtleftfwdannXref;
FlightSimFloat winofflleftfwdannXref;
FlightSimFloat winovhtrightfwdannXref;
FlightSimFloat winoffrfightfwdannXref;
FlightSimFloat winovhtrightsideannXref;
FlightSimFloat winoffrrightsideannXref;
FlightSimFloat capt1auxannXref;
FlightSimFloat fo2statannXref;
FlightSimFloat leftelevpitotannXref;
FlightSimFloat leftalphavaneannXref;
FlightSimFloat tempprobeannXref;
FlightSimFloat fo2auxannXref;
FlightSimFloat captstat1annXref;
FlightSimFloat rightelevpitotannXref;
FlightSimInteger winheatleftsideactXref;
FlightSimInteger winheatleftfwdactXref;
FlightSimInteger winheatrightsideactXref;
FlightSimInteger winheatrightfwdactXref;
FlightSimInteger pitotaactXref;
FlightSimInteger pitotbactXref;
FlightSimInteger winheattestactXref;

//Bounce Switches
Bounce winheatleftsideSw = Bounce (WINHEAT_LEFT_SIDE_SW_PIN, 5);
Bounce winheatleftfwdSw = Bounce (WINHEAT_LEFT_FWD_SW_PIN, 5);
Bounce winheatrightsideSw = Bounce (WINHEAT_RIGHT_SIDE_SW_PIN, 5);
Bounce winheatrightfwdSw = Bounce (WINHEAT_RIGHT_FWD_SW_PIN, 5);
Bounce pitotaSw = Bounce (PITOT_A_SW_PIN, 5);
Bounce pitotbSw = Bounce (PITOT_B_SW_PIN, 5);
Bounce winheattestSw = Bounce (WINHEAT_TEST_SW_PIN, 5);
Bounce winpwrtestSw = Bounce (WIN_PWR_TEST_SW_PIN, 5);

elapsedMillis sinceUpdate;

// setup runs once
void setup() {
  Serial.begin(38400);

  //IXEG Datarefs
  winovhtleftsideannXref = XPlaneRef("ixeg/733/antiice/ai_winovht_l_side_ann");
  winoffleftsideannXref = XPlaneRef("ixeg/733/antiice/ai_winoff_l_side_ann");
  winovhtleftfwdannXref = XPlaneRef("ixeg/733/antiice/ai_winovht_l_fwd_ann");
  winofflleftfwdannXref = XPlaneRef("ixeg/733/antiice/ai_winoff_l_fwd_ann");
  winovhtrightfwdannXref = XPlaneRef("ixeg/733/antiice/ai_winovht_r_fwd_ann");
  winoffrfightfwdannXref = XPlaneRef("ixeg/733/antiice/ai_winoff_r_fwd_ann");
  winovhtrightsideannXref = XPlaneRef("ixeg/733/antiice/ai_winovht_r_side_ann");
  winoffrrightsideannXref = XPlaneRef("ixeg/733/antiice/ai_winoff_r_side_ann");
  capt1auxannXref = XPlaneRef("ixeg/733/antiice/ai_capt_1_aux_ann");
  fo2statannXref = XPlaneRef("ixeg/733/antiice/ai_fo_2_stat_ann");
  leftelevpitotannXref  = XPlaneRef("ixeg/733/antiice/ai_l_elev_pitot_ann");
  leftalphavaneannXref = XPlaneRef("ixeg/733/antiice/ai_l_alpha_vane_ann");
  tempprobeannXref = XPlaneRef("ixeg/733/antiice/ai_temp_probe_ann");
  fo2auxannXref = XPlaneRef("ixeg/733/antiice/ai_fo_2_aux_ann");
  captstat1annXref = XPlaneRef("ixeg/733/antiice/ai_capt_stat_1_ann");
  rightelevpitotannXref = XPlaneRef("ixeg/733/antiice/ai_r_elev_pitot_ann");
  winheatleftsideactXref = XPlaneRef("ixeg/733/antiice/ai_winheat_l_side_act");
  winheatleftfwdactXref = XPlaneRef("ixeg/733/antiice/ai_winheat_l_fwd_act");
  winheatrightsideactXref = XPlaneRef("ixeg/733/antiice/ai_winheat_r_side_act");
  winheatrightfwdactXref = XPlaneRef("ixeg/733/antiice/ai_winheat_r_fwd_act");
  pitotaactXref = XPlaneRef("ixeg/733/antiice/ai_pitot_a_act");
  pitotbactXref = XPlaneRef("ixeg/733/antiice/ai_pitot_b_act");
  winheattestactXref = XPlaneRef("ixeg/733/antiice/ai_winheat_test_act"); //Overheat position = -1.00, Pwr Test = 1 , Off = 0


//define Teensy pin types 
pinMode (WIN_OVHT_LEFT_SIDE_LT_PIN, OUTPUT);
pinMode (WIN_OFF_LEFT_SIDE_LT_PIN, OUTPUT);
pinMode (WIN_OVHT_LEFT_FWD_LT_PIN, OUTPUT);
pinMode (WIN_OFF_LEFT_FWD_LT_PIN, OUTPUT);
pinMode (WIN_OVHT_RIGHT_FWD_LT_PIN, OUTPUT);
pinMode (WIN_OFF_RIGHT_FWD_LT_PIN, OUTPUT);
pinMode (WIN_OVHT_RIGHT_SIDE_LT_PIN, OUTPUT);
pinMode (WIN_OFF_RIGHT_SIDE_LT_PIN, OUTPUT);
pinMode (CAPT1_AUX_LT_PIN, OUTPUT);
pinMode (FO_2_STAT_LT_PIN, OUTPUT);
pinMode (LEFT_ELEV_PITOT_LT_PIN, OUTPUT);
pinMode (LEFT_ALPHA_VANE_LT_PIN, OUTPUT);
pinMode (TEMP_PROBE_LT_PIN, OUTPUT);
pinMode (FO_2_AUX_LT_PIN, OUTPUT);
pinMode (CAPT_STAT1_LT_PIN, OUTPUT);
pinMode (RIGHT_ELEV_PITOT_LT_PIN, OUTPUT);
pinMode (WINHEAT_LEFT_SIDE_SW_PIN, INPUT_PULLUP);
pinMode (WINHEAT_LEFT_FWD_SW_PIN, INPUT_PULLUP);
pinMode (WINHEAT_RIGHT_SIDE_SW_PIN, INPUT_PULLUP);
pinMode (WINHEAT_RIGHT_FWD_SW_PIN, INPUT_PULLUP);
pinMode (PITOT_A_SW_PIN, INPUT_PULLUP);
pinMode (PITOT_B_SW_PIN, INPUT_PULLUP);
pinMode (WINHEAT_TEST_SW_PIN, INPUT_PULLUP);
pinMode (WIN_PWR_TEST_SW_PIN, INPUT_PULLUP);

}

//Function Definitions

//This function used for lighting korrys
void setAnnunciator(float value, const uint8_t outputPin) {
  digitalWrite(outputPin, value > LIGHT_THRESHOLD ? HIGH : LOW);
}

//This function used for a single toggle switch
void updateFunction(Bounce *bounce, FlightSimInteger *dataRef, bool resync) {
  if (bounce->update() || resync) {
    if (!bounce->read()) {
      *dataRef = 1;
    } else {
      *dataRef = 0;
    }
  }
}

//This function used for a 3 position Toggle switch
void updateFunctionDoubleSwitch(Bounce *bounce1, Bounce *bounce2, FlightSimInteger *dataRef, int val1, int val2, int valNone, bool resync) {
  // Check if switches have been changed.
  // We can't use "if (bounce1->update() || bounce2->update())..." here, because that way, if bounce1->update() returned true,
  // bounce2->update() wouldn't even be called, meaning that the switch wouldn't be debounced.
  // Another way to do this would be "if (bounce1->update() | bounce2->update())..." (using an ARITHMETIC or - single vertical
  // bar), but that is error prone.
  bool bounce1Updated = bounce1->update();
  bool bounce2Updated = bounce2->update();
  if (bounce1Updated || bounce2Updated || resync) {
    if (!bounce1->read()) {
      *dataRef = val1;
    } else if (!bounce2->read()) {
      *dataRef = val2;
    } else {
      *dataRef = valNone;
    }
  } 
}

//End Function Definitions

bool wasEnabled = false;

bool checkResync() {
  // check if flight sim was just enabled
  // this is the case if it WAS NOT enabled before and IS enabled now
  bool newEnabled = FlightSim.isEnabled();
  bool result = (!wasEnabled) && newEnabled;
  wasEnabled = newEnabled;
  return result;
}


// loop runs repetitively, as long as power is on
void loop() {
  FlightSim.update();
  bool resync = checkResync();
 
//***Switches***
updateFunction(&winheatleftsideSw, &winheatleftsideactXref, resync);
updateFunction(&winheatleftfwdSw, &winheatleftfwdactXref, resync);
updateFunction(&winheatrightsideSw, &winheatrightsideactXref, resync);
updateFunction(&winheatrightfwdSw, &winheatrightfwdactXref, resync);
updateFunction(&pitotaSw, &pitotaactXref, resync);
updateFunction(&pitotbSw, &pitotbactXref, resync);
updateFunctionDoubleSwitch(&winheattestSw,  &winpwrtestSw,   &winheattestactXref,     -1, 1, 0, resync);
 
//*****Outputs*****
setAnnunciator(winovhtleftsideannXref, WIN_OVHT_LEFT_SIDE_LT_PIN);
//setAnnunciator(winoffleftsideannXref, WIN_OFF_LEFT_SIDE_LT_PIN); //Note - commented out because the IXEG uses OFF lights instead of ON lights
setAnnunciator(winovhtleftfwdannXref, WIN_OVHT_LEFT_FWD_LT_PIN);
//setAnnunciator(winofflleftfwdannXref, WIN_OFF_LEFT_FWD_LT_PIN);
setAnnunciator(winovhtrightfwdannXref, WIN_OVHT_RIGHT_FWD_LT_PIN);
//setAnnunciator(winoffrfightfwdannXref , WIN_OFF_RIGHT_FWD_LT_PIN);
setAnnunciator(winovhtrightsideannXref, WIN_OVHT_RIGHT_SIDE_LT_PIN);
//setAnnunciator(winoffrrightsideannXref, WIN_OFF_RIGHT_SIDE_LT_PIN);
setAnnunciator(capt1auxannXref, CAPT1_AUX_LT_PIN);
setAnnunciator(fo2statannXref, FO_2_STAT_LT_PIN);
setAnnunciator(leftelevpitotannXref, LEFT_ELEV_PITOT_LT_PIN);
setAnnunciator(leftalphavaneannXref, LEFT_ALPHA_VANE_LT_PIN);
setAnnunciator(tempprobeannXref, TEMP_PROBE_LT_PIN);
setAnnunciator(fo2auxannXref, FO_2_AUX_LT_PIN);
setAnnunciator(captstat1annXref, CAPT_STAT1_LT_PIN);
setAnnunciator(rightelevpitotannXref, RIGHT_ELEV_PITOT_LT_PIN);

//Note - had to add these in and reverse High and Low because IXEG uses OFF lights instead of ON lights
  if (winoffleftsideannXref > LIGHT_THRESHOLD) {
    digitalWrite(WIN_OFF_LEFT_SIDE_LT_PIN, LOW);
  } else {
    digitalWrite(WIN_OFF_LEFT_SIDE_LT_PIN, HIGH);
  }
    if (winofflleftfwdannXref > LIGHT_THRESHOLD) {
    digitalWrite(WIN_OFF_LEFT_FWD_LT_PIN, LOW);
  } else {
    digitalWrite(WIN_OFF_LEFT_FWD_LT_PIN, HIGH);
  }
    if (winoffrfightfwdannXref > LIGHT_THRESHOLD) {
    digitalWrite(WIN_OFF_RIGHT_FWD_LT_PIN, LOW);
  } else {
    digitalWrite(WIN_OFF_RIGHT_FWD_LT_PIN, HIGH);
  }
    if (winoffrrightsideannXref > LIGHT_THRESHOLD) {
    digitalWrite(WIN_OFF_RIGHT_SIDE_LT_PIN, LOW);
  } else {
    digitalWrite(WIN_OFF_RIGHT_SIDE_LT_PIN, HIGH);
  }
 
}

Offline Steenos

  • Forum GURU
  • *
  • Posts: 85
  • Karma: +1/-1
  • Aviation Enthusiast
  • First Name: Justin
  • Home Location: KCHA
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #140 on: March 05, 2018, 09:02:51 PM »
Dang that looks pretty intense to me!

Offline 727737Nut

  • I spend way too much on this forum!
  • *
  • Posts: 916
  • Karma: +2/-0
  • 737-300 Using Real parts and X-Plane 10
  • First Name: Rob Archer
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #141 on: March 05, 2018, 11:19:20 PM »
Dang that looks pretty intense to me!

There is a new library out that would cut that sketch in half.  And just for comparison, here is my old sketch that i am using  Haven't updated mine yet to the new library.

#include <Bounce.h>



FlightSimFloat WhL1;
FlightSimFloat WhL2;
FlightSimFloat WhR1;
FlightSimFloat WhR2;
FlightSimFloat PitHeatA;
FlightSimFloat PitHeatB;
FlightSimFloat OvhtTest1; //Overheat position = -1.00
FlightSimFloat OvhtTest2; //Pwr Test = 1 , Off = 0
FlightSimFloat LsOvht;
FlightSimFloat LfOvht;
FlightSimFloat RfOvht;
FlightSimFloat RsOvht;
FlightSimFloat LsON;
FlightSimFloat LfON;
FlightSimFloat RfON;
FlightSimFloat RsON;
FlightSimFloat CaptAux1;
FlightSimFloat FoStatic1;
FlightSimFloat LelevPitot;
FlightSimFloat TempProbe;
FlightSimFloat FoStatic2;
FlightSimFloat CaptStatic1;
FlightSimFloat RelevPitot;

Bounce WhL1Sw = Bounce (22, 5);
Bounce WhL2Sw = Bounce (21, 5);
Bounce WhR1Sw = Bounce (23, 5);
Bounce WhR2Sw = Bounce (17, 5);
Bounce PitHeatASw = Bounce (20, 5);
Bounce PitHeatBSw = Bounce (19, 5);
Bounce OvhtTest1Sw = Bounce (16, 5);
Bounce OvhtTest2Sw = Bounce (18, 5); //Power Test


elapsedMillis sinceUpdate;

void setup() {
  pinMode(16, INPUT_PULLUP); //OVHT test SW
  pinMode(17, INPUT_PULLUP); //Rt FWD Heat SW
  pinMode(18, INPUT_PULLUP); //PWR Test SW
  pinMode(19, INPUT_PULLUP); //Pitot B SW
  pinMode(20, INPUT_PULLUP); //Pitot A SW
  pinMode(21, INPUT_PULLUP); //Lt FWD Heat SW
  pinMode(22, INPUT_PULLUP); // Lt Side Heat SW
  pinMode(23, INPUT_PULLUP); // Rt Side Heat SW
  // Outputs to Korry's
  pinMode(0, OUTPUT); //Lt Side Ovht
  pinMode(1, OUTPUT); //Lt Side ON
  pinMode(2, OUTPUT); //Rt Side Ovht
  pinMode(3, OUTPUT); //Rt Fwd Ovht
  pinMode(4, OUTPUT); //Rt Fwd ON
  pinMode(5, OUTPUT); //Rt Side ON
  pinMode(6, OUTPUT); //Lt Fwd Ovht
  pinMode(7, OUTPUT); //Lt Fwd ON
  pinMode(8, OUTPUT); // Unassigned
  pinMode(9, OUTPUT); //Lt Temp Probe
  pinMode(10, OUTPUT); //Capt Static 1
  pinMode(11, OUTPUT); //Lt Elev Pitot
  pinMode(12, OUTPUT); //missing Korry
  pinMode(13, OUTPUT); //Rt Elev Pitot
  pinMode(14, OUTPUT); //FO Static 2
  pinMode(15, OUTPUT); //FO Static 1

  //IXEG Datarefs
  WhL1        = XPlaneRef("ixeg/733/antiice/ai_winheat_l_side_act");
  WhL2        = XPlaneRef("ixeg/733/antiice/ai_winheat_l_fwd_act");
  WhR1        = XPlaneRef("ixeg/733/antiice/ai_winheat_r_side_act");
  WhR2        = XPlaneRef("ixeg/733/antiice/ai_winheat_r_fwd_act");
  PitHeatA    = XPlaneRef("ixeg/733/antiice/ai_pitot_a_act");
  PitHeatB    = XPlaneRef("ixeg/733/antiice/ai_pitot_b_act");
  OvhtTest1   = XPlaneRef("ixeg/733/antiice/ai_winheat_test_act"); //Overheat position = -1.00
  OvhtTest2   = XPlaneRef("ixeg/733/antiice/ai_winheat_test_act"); //Pwr Test = 1 , Off = 0
  LsOvht      = XPlaneRef("ixeg/733/antiice/ai_winovht_l_side_ann");
  LfOvht      = XPlaneRef("ixeg/733/antiice/ai_winovht_r_fwd_ann");
  RfOvht      = XPlaneRef("ixeg/733/antiice/ai_winovht_r_fwd_ann");
  RsOvht      = XPlaneRef("ixeg/733/antiice/ai_winovht_r_side_ann");
  LsON        = XPlaneRef("ixeg/733/antiice/ai_winoff_l_side_ann");
  LfON        = XPlaneRef("ixeg/733/antiice/ai_winoff_l_fwd_ann");
  RfON        = XPlaneRef("ixeg/733/antiice/ai_winoff_r_fwd_ann");
  RsON        = XPlaneRef("ixeg/733/antiice/ai_winoff_r_side_ann");
  CaptAux1    = XPlaneRef("ixeg/733/antiice/ai_capt_1_aux_ann");
  FoStatic1   = XPlaneRef("ixeg/733/antiice/ai_fo_stat_1_ann");
  LelevPitot  = XPlaneRef("ixeg/733/antiice/ai_l_elev_pitot_ann");
  TempProbe   = XPlaneRef("ixeg/733/antiice/ai_temp_probe_ann");
  FoStatic2   = XPlaneRef("ixeg/733/antiice/ai_fo_2_aux_ann");
  CaptStatic1 = XPlaneRef("ixeg/733/antiice/ai_capt_stat_1_ann");
  RelevPitot  = XPlaneRef("ixeg/733/antiice/ai_r_elev_pitot_ann");

}

void loop() {
  if (sinceUpdate >= 100) {
    sinceUpdate = 0;
    FlightSim.update();
  }

  // Process Outputs
  if (LsOvht > 0.2) {
    digitalWrite(0, HIGH);
  } else {
    digitalWrite(0, LOW);
  }
  if (LsON < 0.2) {
    digitalWrite(1, HIGH);
  } else {
    digitalWrite(1, LOW);
  }
  if (RsOvht > 0.2) {
    digitalWrite(2, HIGH);
  } else {
    digitalWrite(2, LOW);
  }
  if (RfOvht > 0.2) {
    digitalWrite(3, HIGH);
  } else {
    digitalWrite(3, LOW);
  }
  if (RfON < 0.2) {
    digitalWrite(4, HIGH);
  } else {
    digitalWrite(4, LOW);
  }
  if (RsON < 0.2) {
    digitalWrite(5, HIGH);
  } else {
    digitalWrite(5, LOW);
  }
  if (LfOvht > 0.2) {
    digitalWrite(6, HIGH);
  } else {
    digitalWrite(6, LOW);
  }
  if (LfON < 0.2) {
    digitalWrite(7, HIGH);
  } else {
    digitalWrite(7, LOW);
  }
  if (TempProbe > 0.2) {
    digitalWrite(9, HIGH);
  } else {
    digitalWrite(9, LOW);
  }
  if (CaptAux1 > 0.2) {
    digitalWrite(10, HIGH);
  } else {
    digitalWrite(10, LOW);
  }
  if (LelevPitot > 0.2) {
    digitalWrite(11, HIGH);
  } else {
    digitalWrite(11, LOW);
  }
  if (RelevPitot > 0.2) {
    digitalWrite(13, HIGH);
  } else {
    digitalWrite(13, LOW);
  }
  if (FoStatic2 > 0.2) {
    digitalWrite(14, HIGH);
  } else {
    digitalWrite(14, LOW);
  }
  if (FoStatic1 > 0.2) {
    digitalWrite(15, HIGH);
  } else {
    digitalWrite(15, LOW);
  }

  // Prcess Switch Inputs

  if (OvhtTest1Sw.update()) {
    if (OvhtTest1Sw.fallingEdge()) {
      OvhtTest1 = -1.0;
    } else {
      OvhtTest1 = 0.0;
    }
  }
  if (OvhtTest2Sw.update()) {
    if (OvhtTest2Sw.fallingEdge()) {
      OvhtTest2 = 1.0;
    } else {
      OvhtTest2 = 0.0;
    }
  }
  if (WhR2Sw.update()) {
    if (WhR2Sw.fallingEdge()) {
      WhR2 = 1.0;
    } else {
      WhR2 = 0.0;
    }
  }
  if (PitHeatBSw.update()) {
    if (PitHeatBSw.fallingEdge()) {
      PitHeatB = 1.0;
    } else {
      PitHeatB = 0.0;
    }
  }
  if (PitHeatASw.update()) {
    if (PitHeatASw.fallingEdge()) {
      PitHeatA = 1.0;
    } else {
      PitHeatA = 0.0;
    }
  }
  if (WhL2Sw.update()) {
    if (WhL2Sw.fallingEdge()) {
      WhL2 = 1.0;
    } else {
      WhL2 = 0.0;
    }
  }
  if (WhL1Sw.update()) {
    if (WhL1Sw.fallingEdge()) {
      WhL1 = 1.0;
    } else {
      WhL1 = 0.0;
    }
  }
  if (WhR1Sw.update()) {
    if (WhR1Sw.fallingEdge()) {
      WhR1 = 1.0;
    } else {
      WhR1 = 0.0;
    }
  }
}

737 Junkie

Offline kurt-olsson

  • I spend way too much on this forum!
  • *
  • Posts: 972
  • Karma: +0/-0
  • 737 -mixed year OEM panel builder.
  • First Name: Peter
  • Home Location: Gothenburg
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #142 on: March 05, 2018, 11:51:29 PM »
As a programmer a tip i have is to use conditional expression and also you can remove the brackets if only oneline within the if statent.


Ex: instead of:

If (a ==1) {
DoSomething(write,LOW)
}
Else
{
DoSomething(write,HIGH)
}

This can be shortened to:

DoSomething(write, a == 1 ? LOW : HIGH);

There are alot of if / else that could be removed i this code. I think i could remove 40% of it with some refactoring.



Offline XOrionFE

  • I am chained to this website!
  • *
  • Posts: 1,692
  • Karma: +19/-2
  • First Name: Scott
  • Home Location: Chicago, IL
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #143 on: March 06, 2018, 07:35:57 AM »
As a programmer a tip i have is to use conditional expression and also you can remove the brackets if only oneline within the if statent.


Ex: instead of:

If (a ==1) {
DoSomething(write,LOW)
}
Else
{
DoSomething(write,HIGH)
}

This can be shortened to:

DoSomething(write, a == 1 ? LOW : HIGH);

There are alot of if / else that could be removed i this code. I think i could remove 40% of it with some refactoring.

Million ways to skin a cat.  This code is not fully optimized.  As you can see, most is function driven but I had to slam the last conditional statements in to get a particular error resolved and tested.    I posted this not so we can discuss programmig technique but so that folks can get an idea of what the effort looks like.   Thank you for the tips.   Lets keep this topic to the overall build updates though.  Perhaps we can eventually have an area on the forum for coding examples and tips 🙂

Scott

Offline Bob Reed

  • Administrator
  • I am chained to this website!
  • *
  • Posts: 2,345
  • Karma: +11/-0
  • Bob the Builder!
  • First Name: Bob
  • Home Location: Holley, New York
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #144 on: March 06, 2018, 08:38:51 AM »
As a programmer a tip i have is to use conditional expression and also you can remove the brackets if only oneline within the if statent.


Ex: instead of:

If (a ==1) {
DoSomething(write,LOW)
}
Else
{
DoSomething(write,HIGH)
}

This can be shortened to:

DoSomething(write, a == 1 ? LOW : HIGH);

There are alot of if / else that could be removed i this code. I think i could remove 40% of it with some refactoring.

Million ways to skin a cat.  This code is not fully optimized.  As you can see, most is function driven but I had to slam the last conditional statements in to get a particular error resolved and tested.    I posted this not so we can discuss programmig technique but so that folks can get an idea of what the effort looks like.   Thank you for the tips.   Lets keep this topic to the overall build updates though.  Perhaps we can eventually have an area on the forum for coding examples and tips 🙂

Scott

Scott, we do have a Arduino Projects section and a LUA section. Arduino Projects has never had a post.
« Last Edit: March 06, 2018, 08:40:18 AM by Bob Reed »

Offline kurt-olsson

  • I spend way too much on this forum!
  • *
  • Posts: 972
  • Karma: +0/-0
  • 737 -mixed year OEM panel builder.
  • First Name: Peter
  • Home Location: Gothenburg
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #145 on: March 06, 2018, 08:42:55 AM »
I posted it because it looked daunting to some people and wanted to show that it can be made easier.

« Last Edit: March 06, 2018, 08:44:29 AM by kurt-olsson »

Online Joe Lavery

  • I may as well be Staff!
  • *
  • Posts: 654
  • Karma: +3/-0
  • 737 Builder
  • First Name: Joseph
  • Home Location: Newport, UK
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #146 on: March 06, 2018, 02:21:14 PM »
Sorry Scott, still looks daunting to my old brain. I'm still at the flash the LED stage.  :) :) :)

Joe.
'Life isn't about waiting for the storm to pass, it's about learning to dance in the rain!'

www.pcpilot.net


Offline paulnd

  • Forum GURU
  • *
  • Posts: 48
  • Karma: +1/-0
  • Aviation Enthusiast
  • First Name: Paul
  • Home Location: London
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #147 on: March 06, 2018, 03:01:43 PM »
As a programmer a tip i have is to use conditional expression and also you can remove the brackets if only oneline within the if statent.


Ex: instead of:

If (a ==1) {
DoSomething(write,LOW)
}
Else
{
DoSomething(write,HIGH)
}

This can be shortened to:

DoSomething(write, a == 1 ? LOW : HIGH);

There are alot of if / else that could be removed i this code. I think i could remove 40% of it with some refactoring.
Hi,

Tips like this are incredibly useful to self taught arduino "programmers" (I use the term very loosely!) like me.

I'll be grateful if you could consider opening a new thread with any other similar tips or links to tips?

Apologies for highjacking this thread.

Regards

Paul

Sent from my Nexus 7 using Tapatalk


Offline KyleH

  • Administrator
  • Forum GURU
  • *
  • Posts: 387
  • Karma: +1/-0
  • B763!
  • First Name: Kyle
  • Home Location: Ontario
Re: Scott (and Rob's...) Chicago 737-300 Build
« Reply #148 on: March 06, 2018, 06:49:17 PM »
I posted it because it looked daunting to some people and wanted to show that it can be made easier.

Just wanted to comment on this.


Just because some code is written shorter, doesn't mean it is any easier to follow. Sometimes properly formatted multiple statements can be the better solution if it makes it easier to understand when you come back to it months or years later. Just because some code takes up a lot of space doesn't make it harder to see what is going on.

The embedded programing (microcontroller firmware) I was doing before I changed jobs, we were putting emphasis on proper style, readability, and understandability, over fancy statements that made the text segment shorter. As some sections of our code had safety critical operations this was important.
The other factor with embedded programing is that we had to be very aware of how the compiler would take a statement and then use it on the microcontroller. I remember one compiler that would actually use less memory in the micro if many if,then,else statements were used over a simpler switch statement. Longer C file but smaller operating code size.

 

COUNTDOWN TO WF2018


WORLDFLIGHT TEAM USA

Will Depart in...

Recent Posts

737-800 Arduino X-Plane Build
by kurt-olsson
[Today at 05:31:45 PM]
Anyone using Project magenta with P3Dv4?
by Pantu
[Today at 05:17:11 PM]
Relay causes bad readings
by kurt-olsson
[Today at 05:16:22 PM]
What have you done for your simulator today?
by jackpilot
[Today at 02:55:02 PM]
Opencockpit Rotary Encoders
by Nolatron
[Today at 12:49:58 PM]
Where do i begin from here.
by kurt-olsson
[September 24, 2018, 11:32:29 AM]
John's List of 3D Printed Items for Flight Simulation
by blueskydriver
[September 23, 2018, 02:55:02 PM]
737NG Go-Around_Procedure
by bravolima
[September 23, 2018, 01:10:24 PM]
Memphis 727 Build
by kurt-olsson
[September 23, 2018, 10:01:29 AM]
OEM Throttle Quadrant Conversions?
by bernard S
[September 22, 2018, 07:29:48 AM]
For Sale - FSC Motorised Throttle Quadrant
by KyleH
[September 21, 2018, 09:18:02 PM]
Just to make sure i am not doing anything stupid
by kurt-olsson
[September 21, 2018, 01:57:12 PM]
My project, 737 in the basement.
by mickc
[September 21, 2018, 05:48:19 AM]
New guy intro and 727 cockpit for X-Plane project start
by Flying_Fox
[September 19, 2018, 05:06:50 PM]
Flying Polar Routes
by jackpilot
[September 18, 2018, 12:07:33 PM]
STEERING AND YOKE 737 PROMO
by navymustang
[September 17, 2018, 03:44:39 PM]
Monitor and keyboard arm
by navymustang
[September 17, 2018, 03:43:17 PM]
With 60 Days Left, We have a plan
by FredK
[September 17, 2018, 11:08:58 AM]
For Sale: CPFlight MCP 737 EL $400 USD Shipped Lower 48
by Steenos
[September 17, 2018, 11:01:18 AM]
INTRODUCTION
by bernard S
[September 15, 2018, 07:10:49 PM]
Wanted Pair of Headrests of this type!
by bernard S
[September 15, 2018, 06:43:09 PM]
Some Questions about Project Magenta CDU
by Pantu
[September 15, 2018, 10:35:41 AM]
GAPanel/FSUIPC coding
by sedge
[September 14, 2018, 02:22:31 PM]
Wanted! Real Boeing 737 TQ
by kurt-olsson
[September 14, 2018, 04:24:57 AM]
OEM window eye brow trim
by kurt-olsson
[September 14, 2018, 04:22:20 AM]
Linked Brakes
by blueskydriver
[September 14, 2018, 03:12:26 AM]
Mickey's Flightdeck - A Boeing 737-800 Cockpit on Youtube
by Extraterra
[September 13, 2018, 09:23:22 AM]
CDU hidden fire page
by Pantu
[September 12, 2018, 01:25:24 PM]
737NG parts for sale, most are REAL!
by 737NGer
[September 12, 2018, 11:22:50 AM]
A320 Sound (for homecockpit)
by okansacli
[September 12, 2018, 10:07:03 AM]