Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C027 C12832 EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed
Revision 140:37588866ce18, committed 2014-03-19
- Comitter:
- ansond
- Date:
- Wed Mar 19 04:00:56 2014 +0000
- Parent:
- 139:1eef48a644a0
- Child:
- 141:0a09f2d03528
- Commit message:
- updates
Changed in this revision
| MBEDEndpoint.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MBEDEndpoint.cpp Wed Mar 19 03:51:12 2014 +0000
+++ b/MBEDEndpoint.cpp Wed Mar 19 04:00:56 2014 +0000
@@ -39,6 +39,9 @@
// default constructor
MBEDEndpoint::MBEDEndpoint(ErrorHandler *error_handler,EthernetInterface *ethernet) {
bool success = true;
+ this->m_preferences = NULL;
+ memset(this->m_lcd_status,0,TEMP_BUFFER_LEN+1);
+ memset(this->m_nsp_address,0,PREFERENCE_VALUE_LEN+1);
for(int i=0;i<NUM_TRANSPORTS;++i) this->m_transports[i] = NULL;
this->m_error_handler = error_handler;
if (success) this->initPreferences();
@@ -51,7 +54,7 @@
if (success)this->logger()->log(ENDPOINT_VERSION_ANNOUNCE);
#endif
if (success) this->initGWAddress();
- if (success) this->logger()->log("IOC Gateway IP: %s",GW_IPADDRESS);
+ if (success) this->logger()->log("IOC GW IP: %s",GW_IPADDRESS);
if (PL_ENABLE && success) this->logger()->log("Philips Light ID: %d Philips Gateway IP: %s",PL_LIGHT_ID,PL_GW_ADDRESS);
if (success) success = this->initializeEthernet(ethernet);
if (success) this->logger()->turnLEDYellow();
@@ -110,9 +113,10 @@
// initialize the Lights
bool MBEDEndpoint::initializeLights() {
+ int index = this->preferences()->getIntPreference("endpoint_id",LIGHT_NAME_INDEX);
this->logger()->log("Initializing Lights...");
for(int i=0;i<NUM_LIGHTS;++i) {
- this->m_lights[i] = new MBEDLight(this->logger(),this->m_transports,i+1,this);
+ this->m_lights[i] = new MBEDLight(this->logger(),this->m_transports,i+index,this);
this->m_lights[i]->setDimmerAction(new EmulatedLightDimmerAction(this->logger(),this->m_lights[i]));
this->m_lights[i]->setSwitchAction(new EmulatedLightSwitchAction(this->logger(),this->m_lights[i]));
}