Page 4 of 5 FirstFirst 12345 LastLast
Results 31 to 40 of 41

Thread: Where do I even start??

  1. #31
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    I count 4+1 fan speeds (LOW, MEDIUM LOW, MEDIUM HIGH, HIGH, and then OFF). Your enumeration for fan speeds has 8+1 fan speeds. LOWON and LOWOFF are not fans speeds. LOW is a fan speed that can be either on or off.

    You also have a digital output for on and another for off. Is this how you have it wired in the car? Every fan speed takes 2 relays? Or does every fan speed take 1 relay (to select it) or off which is just none of them on?
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  2. #32
    Low Bitrate
    Join Date
    Jul 2007
    Posts
    65
    OH, ok. I do have just 4 relays for the fan speeds.

    so then I should remove the on/off and leave the enums as just low, mediumlow, etc.

    Down below in the public void setup hvac... I should have the same right? Delete out the on off and just leave it as the speed.

    in the textures section, I would want to leave them all? because I would need a texture for each?

    Then in the "switch (current Fan Speed) would I need one area for each, or would I code it more like

    Code:
    case FanSpeed.OFF:
                        currentFanSpeed = FanSpeed.ON;
                        break;
    Last edited by jjohnston; 02-01-2013 at 11:55 AM.

  3. #33
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    I have not tested this yet, but it should be almost there:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FB_USB_2011;
    using FuseGL.GUI;
    
    namespace HVAC_Example
    {
        public class HVAC_Example
        {
            public enum FanSpeed
            {
                OFF,
                LOW,
                MEDIUM_LOW,
                MEDIUM_HIGH,
                HIGH
            }
    
            internal class HVAC_FanSpeed_Button
            {
                public FB_Monitor.DigitalOutputPort DigitalOutputPort;
                public FuseGL.GUI.FuseGL_Object FGLO;
                public FuseGL.GUI.FGLO_Texture FGLO_Texture_FanSpeed___ON;
                public FuseGL.GUI.FGLO_Texture FGLO_Texture_FanSpeed___OFF;
                private bool ___internalONLY___isOn = false;
                public bool isON
                {
                    get { return ___internalONLY___isOn; }
                    set
                    {
                        if (this.FGLO != null)
                        {
                            this.FGLO.TextureIsBeingOverriddenAndControlledExternally = true;
                            if (value)
                            {
                                this.FGLO.TextureToOverrideWith = FGLO_Texture_FanSpeed___ON;
                                DigitalOutputPort.Value = FB_Monitor.DigitalOutputPort.DIGITAL_OUTPUT_ON;
                            }
                            else
                            {
                                this.FGLO.TextureToOverrideWith = FGLO_Texture_FanSpeed___OFF;
                                DigitalOutputPort.Value = FB_Monitor.DigitalOutputPort.DIGITAL_OUTPUT_OFF;
                            }
                        }
                        ___internalONLY___isOn = value;
                    }
                }
    
                public FanSpeed _speed;
    
                public HVAC_FanSpeed_Button(FB_Monitor.DigitalOutputPort digitalOutputPort, FuseGL_Object fglo, FGLO_Texture fgloTextureFanSpeedOn, FGLO_Texture fgloTextureFanSpeedOff, FanSpeed speed)
                {
                    DigitalOutputPort = digitalOutputPort;
                    FGLO = fglo;
                    FGLO_Texture_FanSpeed___ON = fgloTextureFanSpeedOn;
                    FGLO_Texture_FanSpeed___OFF = fgloTextureFanSpeedOff;
                    _speed = speed;
                }
            }
    
            internal Dictionary<FuseGL_Object, HVAC_FanSpeed_Button> FanSpeedLookupDictionary = new Dictionary<FuseGL_Object, HVAC_FanSpeed_Button>();
            internal FanSpeed currentFanSpeed = FanSpeed.OFF;
    
            public void setup_HVAC(
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___low,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___medium_low,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___medium_high,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___high,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_low,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_medium_low,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_medium_high, 
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_high
                                  )
            {
                // Setup FanSpeed textures and ports
                addFanSpeedToDictionary(FanSpeed.LOW, _digitalOutputPort_for_fan_low, displayFuseGL_Object_for_fan_speed___low, "images/HVAC/FanSpeed/Low/On.png", "images/HVAC/FanSpeed/Low/Off.png");
                addFanSpeedToDictionary(FanSpeed.MEDIUM_LOW, _digitalOutputPort_for_fan_medium_low, displayFuseGL_Object_for_fan_speed___medium_low, "images/HVAC/FanSpeed/MediumLow/On.png", "images/HVAC/FanSpeed/MediumLow/Off.png");
                addFanSpeedToDictionary(FanSpeed.MEDIUM_HIGH, _digitalOutputPort_for_fan_medium_high, displayFuseGL_Object_for_fan_speed___medium_high, "images/HVAC/FanSpeed/MediumHigh/On.png", "images/HVAC/FanSpeed/MediumHigh/Off.png");
                addFanSpeedToDictionary(FanSpeed.HIGH, _digitalOutputPort_for_fan_high, displayFuseGL_Object_for_fan_speed___high, "images/HVAC/FanSpeed/High/On.png", "images/HVAC/FanSpeed/High/Off.png");
                
                // Change the image to something known to begin with
                TurnOffAllFanSpeeds();
            }
    
            private void addFanSpeedToDictionary(FanSpeed speed, FB_Monitor.DigitalOutputPort _digitalOutputPort, FuseGL.GUI.FuseGL_Object FGLO, string path_for_on_image, string path_for_off_image)
            {
                FanSpeedLookupDictionary.Add(FGLO, new HVAC_FanSpeed_Button(_digitalOutputPort, FGLO, FGLO_Texture.MakeQuickFGLOTexture___ConvertFromExternalImagePath("HVAC_Fan_Control___FanSpeedImage___" + speed.ToString() + "___ON", path_for_on_image), FGLO_Texture.MakeQuickFGLOTexture___ConvertFromExternalImagePath("HVAC_Fan_Control___FanSpeedImage___" + speed.ToString() + "___OFF", path_for_off_image), speed));
    
                // Hook into when the FGLO is pressed
                FGLO.MouseEvent___ClickDown += new FuseGL_Object.FuseGL_FGLO_MouseEvent(ChangeHVAC_FanSpeed_Button_Was_Pressed);
            }
    
            void  ChangeHVAC_FanSpeed_Button_Was_Pressed(object sender, FuseGL.FuseGL_GUI.MouseEventInformation MouseInfo)
            {
                // The FGLO object that triggered this
                FuseGL_Object FGLObuttonPressed = (FuseGL_Object)sender;
    
                if (FanSpeedLookupDictionary.ContainsKey(FGLObuttonPressed))
                {
                    // The button that is represented by this FGLO
                    HVAC_FanSpeed_Button HVAC_Button_Pressed = FanSpeedLookupDictionary[FGLObuttonPressed];
    
                    // Turn off all the fan speeds first
                    TurnOffAllFanSpeeds();
    
                    // If the button is already on...
                    if (HVAC_Button_Pressed._speed == currentFanSpeed)
                    {
                        // Then go to OFF
                        currentFanSpeed = FanSpeed.OFF;
                    }
                    else
                    {
                        HVAC_Button_Pressed.isON = true;
                        // Put some info in the trace for debugging perhaps?
                        FuseGL.FuseGL_Debugger.Trace.Add("Changing Fan Speed to / from: " + HVAC_Button_Pressed._speed + " / " + currentFanSpeed);
                        currentFanSpeed = HVAC_Button_Pressed._speed;
                    }
                }
            }
    
            private void TurnOffAllFanSpeeds()
            {
                // First turn off all the outputs
                foreach (KeyValuePair<FuseGL_Object, HVAC_FanSpeed_Button> aFanSpeedButton in FanSpeedLookupDictionary)
                {
                    aFanSpeedButton.Value.isON = false;
                }
            }
        }
    }
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  4. #34
    Low Bitrate
    Join Date
    Jul 2007
    Posts
    65
    Ok, I will replace my file with this one and see. I will most likely need to edit my config file I would think.

    From:
    Code:
    <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="Logic/ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{this};{FB.DigitalOutput(0.1)};{FB.DigitalOutput(0.2)};{FB.DigitalOutput(0.3)};{FB.DigitalOutput(0.4)};" />
        </events>
      </User_Object>
    To:
    Code:
    <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="Logic/ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{this};{FB.DigitalOutput(0.1)};" />
        </events>
      </User_Object>
    Essentially only leaving the 1 digital output that this 1 item would control? I know I would need to change the size and location to match my layout.

  5. #35
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Quote Originally Posted by jjohnston View Post
    Ok, I will replace my file with this one and see. I will most likely need to edit my config file I would think.

    From:
    Code:
    <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="Logic/ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{this};{FB.DigitalOutput(0.1)};{FB.DigitalOutput(0.2)};{FB.DigitalOutput(0.3)};{FB.DigitalOutput(0.4)};" />
        </events>
      </User_Object>
    To:
    Code:
    <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="Logic/ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{this};{FB.DigitalOutput(0.1)};" />
        </events>
      </User_Object>
    Essentially only leaving the 1 digital output that this 1 item would control? I know I would need to change the size and location to match my layout.
    You definitely have to edit your config file. You need change the configuration file. Since you are having lots of startup events that effect many different FuseGLObjects, you should add it in the global section.

    Like this:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <FuseGL_User_Settings>
      <Persistant_Variables>
        <variable name="autoVariable___[Sensor - Temperature in Celcius[0,1] - OUTSIDE TEMPERATURE]" first_value="0.0" type="double" />
      </Persistant_Variables>
      <Startup_Events>
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR LOW};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM LOW};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM HIGH};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR HIGH};{FB.DigitalOutput(0.1)};{FB.DigitalOutput(0.2)};{FB.DigitalOutput(0.3)};{FB.DigitalOutput(0.4)};" />
        </events>
      </Startup_Events>
      <FusionBrainOnline>
        <Login_Details user_name="" password="" />
        <Status enabled="true" />
      </FusionBrainOnline>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR LOW" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="50" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM LOW" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="50" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM HIGH" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="50" y="300" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR HIGH" />
        <image location="internal" path="NULL" />
        <size width="200" height="200" />
        <location x="300" y="300" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
    </FuseGL_User_Settings>
    You have to keep the syntax correct for the setup section:

    Code:
            public void setup_HVAC(
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___low,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___medium_low,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___medium_high,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_fan_speed___high,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_low,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_medium_low,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_medium_high, 
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_fan_high
                                  )
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  6. #36
    Low Bitrate
    Join Date
    Jul 2007
    Posts
    65
    Thanks!! That worked perfect!

    So If I wanted to do the same thing with the panel position buttons (vent, panel, ac, etc.) I thought I could use the same code, but change all the occurances of "FanSpeed" to "Panel" then in my xml add a 2nd line calling my panel .cs file. should that work? below is what I came up with, but for some reason doesn't seem to work. lol

    Logic:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FB_USB_2011;
    using FuseGL.GUI;
    
    namespace HVAC_Panel
    {
        public class HVAC_Panel
        {
            public enum Panel
            {
                OFF,
                AC_MAX,
                AC_NORM,
                VENT,
                HEAT,
                DEFROST,
                BI_LEVEL
            }
    
            internal class HVAC_Panel_Button
            {
                public FB_Monitor.DigitalOutputPort DigitalOutputPort;
                public FuseGL.GUI.FuseGL_Object FGLO;
                public FuseGL.GUI.FGLO_Texture FGLO_Texture_Panel___ON;
                public FuseGL.GUI.FGLO_Texture FGLO_Texture_Panel___OFF;
                private bool ___internalONLY___isOn = false;
                public bool isON
                {
                    get { return ___internalONLY___isOn; }
                    set
                    {
                        if (this.FGLO != null)
                        {
                            this.FGLO.TextureIsBeingOverriddenAndControlledExternally = true;
                            if (value)
                            {
                                this.FGLO.TextureToOverrideWith = FGLO_Texture_Panel___ON;
                                DigitalOutputPort.Value = FB_Monitor.DigitalOutputPort.DIGITAL_OUTPUT_ON;
                            }
                            else
                            {
                                this.FGLO.TextureToOverrideWith = FGLO_Texture_Panel___OFF;
                                DigitalOutputPort.Value = FB_Monitor.DigitalOutputPort.DIGITAL_OUTPUT_OFF;
                            }
                        }
                        ___internalONLY___isOn = value;
                    }
                }
    
                public Panel _speed;
    
                public HVAC_Panel_Button(FB_Monitor.DigitalOutputPort digitalOutputPort, FuseGL_Object fglo, FGLO_Texture fgloTexturePanelOn, FGLO_Texture fgloTexturePanelOff, Panel speed)
                {
                    DigitalOutputPort = digitalOutputPort;
                    FGLO = fglo;
                    FGLO_Texture_Panel___ON = fgloTexturePanelOn;
                    FGLO_Texture_Panel___OFF = fgloTexturePanelOff;
                    _speed = speed;
                }
            }
    
            internal Dictionary<FuseGL_Object, HVAC_Panel_Button> PanelLookupDictionary = new Dictionary<FuseGL_Object, HVAC_Panel_Button>();
            internal Panel currentPanel = Panel.OFF;
    
            public void setup_HVAC(
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___ac_max,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___ac_norm,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___vent,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___heat,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___defrost,
                                    FuseGL.GUI.FuseGL_Object displayFuseGL_Object_for_panel_speed___bi_level,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_ac_max,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_ac_norm,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_vent,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_heat,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_defrost,
                                    FB_Monitor.DigitalOutputPort _digitalOutputPort_for_panel_bi_level
                                  )
            {
                // Setup Panel textures and ports
                addPanelToDictionary(Panel.AC_MAX, _digitalOutputPort_for_panel_ac_max, displayFuseGL_Object_for_panel_speed___ac_max, "images/HVAC/FanSpeed/AcMax/On.png", "images/HVAC/FanSpeed/AcMax/Off.png");
                addPanelToDictionary(Panel.AC_NORM, _digitalOutputPort_for_panel_ac_norm, displayFuseGL_Object_for_panel_speed___ac_norm, "images/HVAC/FanSpeed/AcNorm/On.png", "images/HVAC/FanSpeed/ACNorm/Off.png");
                addPanelToDictionary(Panel.VENT, _digitalOutputPort_for_panel_vent, displayFuseGL_Object_for_panel_speed___vent, "images/HVAC/FanSpeed/Vent/On.png", "images/HVAC/FanSpeed/Vent/Off.png");
                addPanelToDictionary(Panel.HEAT, _digitalOutputPort_for_panel_heat, displayFuseGL_Object_for_panel_speed___heat, "images/HVAC/FanSpeed/Heat/On.png", "images/HVAC/FanSpeed/Heat/Off.png");
                addPanelToDictionary(Panel.DEFROST, _digitalOutputPort_for_panel_defrost, displayFuseGL_Object_for_panel_speed___defrost, "images/HVAC/FanSpeed/Defrost/On.png", "images/HVAC/FanSpeed/Defrost/Off.png");
                addPanelToDictionary(Panel.BI_LEVEL, _digitalOutputPort_for_panel_bi_level, displayFuseGL_Object_for_panel_speed___bi_level, "images/HVAC/FanSpeed/BiLevel/On.png", "images/HVAC/FanSpeed/BiLevel/Off.png");
    
    
                // Change the image to something known to begin with
                TurnOffAllPanels();
            }
    
            private void addPanelToDictionary(Panel speed, FB_Monitor.DigitalOutputPort _digitalOutputPort, FuseGL.GUI.FuseGL_Object FGLO, string path_for_on_image, string path_for_off_image)
            {
                PanelLookupDictionary.Add(FGLO, new HVAC_Panel_Button(_digitalOutputPort, FGLO, FGLO_Texture.MakeQuickFGLOTexture___ConvertFromExternalImagePath("HVAC_Panel_Control___PanelImage___" + speed.ToString() + "___ON", path_for_on_image), FGLO_Texture.MakeQuickFGLOTexture___ConvertFromExternalImagePath("HVAC_Panel_Control___PanelImage___" + speed.ToString() + "___OFF", path_for_off_image), speed));
    
                // Hook into when the FGLO is pressed
                FGLO.MouseEvent___ClickDown += new FuseGL_Object.FuseGL_FGLO_MouseEvent(ChangeHVAC_Panel_Button_Was_Pressed);
            }
    
            void ChangeHVAC_Panel_Button_Was_Pressed(object sender, FuseGL.FuseGL_GUI.MouseEventInformation MouseInfo)
            {
                // The FGLO object that triggered this
                FuseGL_Object FGLObuttonPressed = (FuseGL_Object)sender;
    
                if (PanelLookupDictionary.ContainsKey(FGLObuttonPressed))
                {
                    // The button that is represented by this FGLO
                    HVAC_Panel_Button HVAC_Button_Pressed = PanelLookupDictionary[FGLObuttonPressed];
    
                    // Turn off all the panel speeds first
                    TurnOffAllPanels();
    
                    // If the button is already on...
                    if (HVAC_Button_Pressed._speed == currentPanel)
                    {
                        // Then go to OFF
                        currentPanel = Panel.OFF;
                    }
                    else
                    {
                        HVAC_Button_Pressed.isON = true;
                        // Put some info in the trace for debugging perhaps?
                        FuseGL.FuseGL_Debugger.Trace.Add("Changing Panel Speed to / from: " + HVAC_Button_Pressed._speed + " / " + currentPanel);
                        currentPanel = HVAC_Button_Pressed._speed;
                    }
                }
            }
    
            private void TurnOffAllPanels()
            {
                // First turn off all the outputs
                foreach (KeyValuePair<FuseGL_Object, HVAC_Panel_Button> aPanelButton in PanelLookupDictionary)
                {
                    aPanelButton.Value.isON = false;
                }
            }
        }
    }

    XML file:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <FuseGL_User_Settings>
      <FuseGL_GUI_Settings>
        <setting type="size" name="gui_size" width="1024" height="600" />
        <setting type="int" gui_border_thickness="0" />
        <setting type="colour" gui_border_colour="20,20,230" />
      </FuseGL_GUI_Settings>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="myBackgroundImage" />
        <image location="external" path="IMG/background.png" />
        <size width="100%" height="100%" />
        <location x="0" y="0" z="0" alignment="L" />
      </User_Object>
      <Persistant_Variables>
        <variable name="autoVariable___[Sensor - Temperature in Celcius[0,1] - OUTSIDE TEMPERATURE]" first_value="0.0" type="double" />
      </Persistant_Variables>
      <Startup_Events>
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="ExternalExamples/HVAC_Example.cs;HVAC_Example.HVAC_Example;setup_HVAC;{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR LOW};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM LOW};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM HIGH};{$FGLO.GL - HVAC CONTROL - FAN SPEED INDICATOR HIGH};{FB.DigitalOutput(0.0)};{FB.DigitalOutput(0.1)};{FB.DigitalOutput(0.2)};{FB.DigitalOutput(0.3)};" />
          <startup action="FuseGL.ExecuteCode" inputArgs="ExternalExamples/HVAC_Panel.cs;HVAC_Panel.HVAC_Panel;setup_HVAC;{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR AC MAX};{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR AC NORM};{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR VENT};{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR HEAT};{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR DEFROST};{$FGLO.GL - HVAC CONTROL - Panel SPEED INDICATOR BI_LEVEL};{FB.DigitalOutput(0.4)};{FB.DigitalOutput(0.5)};{FB.DigitalOutput(0.6)};{FB.DigitalOutput(0.7)};{FB.DigitalOutput(0.8)};{FB.DigitalOutput(0.9)};" />
        </events>
      </Startup_Events>
      <FusionBrainOnline>
        <Login_Details user_name="" password="" />
        <Status enabled="true" />
      </FusionBrainOnline>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR LOW" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="5" y="35" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM LOW" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="5" y="147" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR MEDIUM HIGH" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="5" y="259" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - FAN SPEED INDICATOR HIGH" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="5" y="371" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      //AC MAX
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR AC MAX" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="5" y="483" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      //AC NORMAL
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR AC NORMAL" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="201" y="483" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
     //BI LEVEL
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR BI Level" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="201" y="371" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
     //VENT
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR VENT" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="397" y="483" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      //HEAT
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR HEAT" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="593" y="485" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
      //DEFROST
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - HVAC CONTROL - PANEL SPEED INDICATOR DEFROST" />
        <image location="internal" path="NULL" />
        <size width="192" height="108" />
        <location x="789" y="485" alignment="left" z="0.0" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
      </User_Object>
    </FuseGL_User_Settings>

  7. #37
    Low Bitrate
    Join Date
    Jul 2007
    Posts
    65
    I looked through the logic file again and thought maybe I need to move my image files to a folder named "Panel" but that didn't seem to fix the problem. I did check the trace file and get the following error.

    Problem Executing Code: codeFileName = ExternalExamples/HVAC_Panel.cs | className = HVAC_Panel.HVAC_Panel | functionName = setup_HVAC || System.ArgumentException: Object of type 'System.Collections.Generic.Dictionary`2[System.String,FuseGL.GUI.FuseGL_Object]' cannot be converted to type 'FuseGL.GUI.FuseGL_Object'.
    at FuseGL.Logic.FuseGL_CommonLogic.ExecuteCode(Execut ableCodeClasses _ECC, String functionname, Object[] args)
    at FuseGL.Logic.FuseGL_CommonLogic.ExecuteCode_Entran ce(String codeFileName, String className, String functionName, Object[] inputArgs)
    at FuseGL.FuseGL.ExecuteCode(String codeFileName, String className, String functionName, Object[] inputArgs)
    [4608] 05.02.13|10:07:48:742 >> *** FLYCOMPILE ERROR *** => System.ArgumentException: Object of type 'System.Collections.Generic.Dictionary`2[System.String,FuseGL.GUI.FuseGL_Object]' cannot be converted to type 'FuseGL.GUI.FuseGL_Object'.
    at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
    at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
    at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
    at System.Reflection.RuntimeMethodInfo.InvokeArgument sCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at FuseGL.Logic.FuseGL_CommonLogic.ExecuteCode(Execut ableCodeClasses _ECC, String functionname, Object[] args)
    [4607] 05.02.13|10:07:48:381 >> ** WARNING ** Your Execute code needs to have "Logic\" infront of it to find the correct path. FuseGL is auto-adjusting

  8. #38
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    This is the key:

    System.ArgumentException: Object of type 'System.Collections.Generic.Dictionary`2[System.String,FuseGL.GUI.FuseGL_Object]' cannot be converted to type 'FuseGL.GUI.FuseGL_Object'

    Basically one (or more) of your arguments is invalid. And we know it is one of the FuseGL_Objects. What it is saying is that it can find no record of the FGLO in the FGLO master dictionary. So you are referencing something that doesn't exist. Glancing at your code I see you have "Panel" in your first argument but the FGLO's name has "PANEL" in it. Case matters.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  9. #39
    Low Bitrate
    Join Date
    Jul 2007
    Posts
    65
    OH! I found it. I had fixed the PANEL vs Panel after I had posted, but I found more errors in relation to that area! Thank You SO much for pointing me to the area of the problem! I'm actually glad you pointed me to the direction instead of flat out giving me the answer! I will have to hook up the brain later and test, but on screen it all seems to work now!!

  10. #40
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Glad it seems to work!

    See with one example you have already modified it to do exactly what you want. It is not so hard to do and very flexible. This is the power of FuseGL. Hopefully this gets you started! And of course I will be here to answer any questions you may have.

    If you are OK with posting your code, feel free to post your code/images/config-file for others too. They might not want everything, but having it as a working reference example might help someone else some time in the future.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

Page 4 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. start with oem bezel or start from scratc
    By slociviccoupe in forum Fabrication
    Replies: 4
    Last Post: 04-08-2012, 01:01 AM
  2. start with oem ezel or start from scratc
    By slociviccoupe in forum Fabrication
    Replies: 0
    Last Post: 04-01-2012, 10:54 PM
  3. Remote Start Fried? Car continously tries to start
    By Phatsacks in forum General Hardware Discussion
    Replies: 4
    Last Post: 08-17-2008, 05:39 PM
  4. Replies: 1
    Last Post: 10-23-2006, 09:44 PM
  5. Where to start...
    By Rosebud6 in forum Road Runner
    Replies: 5
    Last Post: 12-09-2005, 03:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •