Define ports by name?

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Define ports by name?

Post by ewaldsreef »

If you define ports by name what does this do exactly?
Does it show up on the app or portal?
Can you Define all of the ports such as the temp, float switch, pwm etc?
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Define ports by name?

Post by Sacohen »

Defining port names in your code like this...

Code: Select all

// Define Relay Ports by Name
#define Actinic_Lights     1
#define Day_Lights         2
#define Kalkwasser         3
#define Pumps              4
#define Unused             5
#define DeNit_Doser        6
#define DeNit_Pump         7
#define ATO_Pump           8

#define Unused             Box1_Port1
#define Feeder             Box1_Port2
#define Unused             Box1_Port3
#define Unused             Box1_Port4
#define Unused             Box1_Port5
#define Unused             Box1_Port6
#define Main_RODI        Box1_Port7
#define Dummy              Box1_Port8
makes it easier to identify which port is doing what in the code.

To have it show up in the App or the Portal it has to be done in the labels section of the Portal and then the App can pull the names from the Portal or you can set them up in the App to under the settings section.
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Re: Define ports by name?

Post by ewaldsreef »

Thank you Steve.
Can I also define temp probes by name?
Image
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Define ports by name?

Post by Sacohen »

I'm not sure you can on the code.
Check lnevo's code. If it can be done I'm sire he has done it.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Define ports by name?

Post by rimai »

Yeah.

Code: Select all

#define T1_PROBE DisplayTemp
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Define ports by name?

Post by lnevo »

Wouldnt it be the other way around roberto?
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Define ports by name?

Post by Smotz »

I have mine like this - does it matter?

Code: Select all

#define Heater Port1
#define Topoff Port2
#define Feeder Port3
#define Skimmer Port4
#define Return Port5
#define Wave Port6
#define UVlight Port7
#define Fugelight Port8
#define Fan  Box1_Port8
#define CalcDose  Box1_Port1
#define AlkDose  Box1_Port2

Sacohen wrote:Defining port names in your code like this...

Code: Select all

// Define Relay Ports by Name
#define Actinic_Lights     1
#define Day_Lights         2
#define Kalkwasser         3
#define Pumps              4
#define Unused             5
#define DeNit_Doser        6
#define DeNit_Pump         7
#define ATO_Pump           8

#define Unused             Box1_Port1
#define Feeder             Box1_Port2
#define Unused             Box1_Port3
#define Unused             Box1_Port4
#define Unused             Box1_Port5
#define Unused             Box1_Port6
#define Main_RODI        Box1_Port7
#define Dummy              Box1_Port8
makes it easier to identify which port is doing what in the code.

To have it show up in the App or the Portal it has to be done in the labels section of the Portal and then the App can pull the names from the Portal or you can set them up in the App to under the settings section.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Define ports by name?

Post by Sacohen »

I guess it doesn't as long as it work.
I guess yours works too.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Define ports by name?

Post by rimai »

lnevo wrote:Wouldnt it be the other way around roberto?
Yes, the other way around... :oops:
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Define ports by name?

Post by cosmith71 »

Smotz wrote:I have mine like this - does it matter?

Code: Select all

#define Heater Port1
#define Topoff Port2
#define Feeder Port3
#define Skimmer Port4
#define Return Port5
#define Wave Port6
#define UVlight Port7
#define Fugelight Port8
#define Fan  Box1_Port8
#define CalcDose  Box1_Port1
#define AlkDose  Box1_Port2
It should work out the same. The libraries define Port1 as 1, Port2 as 2, etc. Steve's version just cuts out a step.

--Colin
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Re: Define ports by name?

Post by ewaldsreef »

So does this work?

Code: Select all

// Define Relay Ports by Name
#define Return             1
#define Actinic            2
#define Daylight           3
#define Skimmer            4
#define Vortechs           5
#define Heater             6
#define Ozone              7
#define Fan                8

#define Return             Box1_Port1
#define Actinic            Box1_Port2
#define Daylight           Box1_Port3
#define Skimmer            Box1_Port4
#define Vortech            Box1_Port5
#define Heater             Box1_Port6
#define Ozone              Box1_Port7
#define Fan                Box1_Port8

#define SumpTemp           T1_PROBE 
#define AmbientTemp        T1_PROBE
#define FragTemp           T1_PROBE
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Define ports by name?

Post by rimai »

You have to change the number of the probes. They are all assigned to T1
Roberto.
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Re: Define ports by name?

Post by ewaldsreef »

Oops
Image
Maze531
Posts: 9
Joined: Fri May 15, 2015 10:06 am
Location: Lake Elsinore ca

Re: Define ports by name?

Post by Maze531 »

i am looking to do this for mine as well. I am still new to this do I just write this in the text box and load it to the controller? It wont affect the current code that I have written?
Robert
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Define ports by name?

Post by cosmith71 »

Maze531 wrote:i am looking to do this for mine as well. I am still new to this do I just write this in the text box and load it to the controller? It wont affect the current code that I have written?
Yes. It goes right under this line in the code.

Code: Select all

////// Place global variable code below here
It won't affect anything. In fact, you'd need to change your current code by changing all the Port1's to Return, for example, for it to make any difference.

--Colin
Maze531
Posts: 9
Joined: Fri May 15, 2015 10:06 am
Location: Lake Elsinore ca

Re: Define ports by name?

Post by Maze531 »

thank you very much I think i have it all figured out now.
Robert
Post Reply