particle-iot / thermostat

A place for all things related to ye olde Spark Thermostat Hackathon
MIT License
719 stars 109 forks source link

Code will not compile in Web IDE #6

Open aspenarnthors opened 9 years ago

aspenarnthors commented 9 years ago

Hi there!

Newbie here trying to pull off the hacked Nest thermostat for a school project. So I guess my issue is, the codes located in Spark/thermostat/firmware aren't compatible to the Spark Web IDE, as it runs only .cpp and .h and some of the files are either .mk and .c . after finding a .cpp version of glcdfont.c, it raised issues in the code relating to code that I guess is integrated in the firmware in the Spark Core.

Is there anywhere else where I should be accessing the codes to use in the Web IDE or is the hacked Nest thermostat not achievable without local development?

I hope I'm phrasing all this correctly!

Any help greatly appreciated.

Here's the error text:

In file included from ../inc/spark_wiring.h:29:0, from Adafruit_GFX.h:4, from Adafruit_GFX.cpp:34: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ In file included from ../inc/spark_wiring.h:29:0, from ../inc/spark_wiring_stream.h:36, from ../inc/spark_wiring_i2c.h:30, from Adafruit_LEDBackpack.h:21, from Adafruit_LEDBackpack.cpp:21: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ In file included from ../inc/spark_wiring.h:29:0, from ../inc/spark_wiring_stream.h:36, from ../inc/spark_wiring_i2c.h:30, from Adafruit_LEDBackpack.h:21, from application.cpp:1: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ application.cpp: In function 'void saveTemperature()': application.cpp:53:3: error: 'Serial' was not declared in this scope Serial.println("Saving temperature to flash"); ^ application.cpp:55:58: error: 'sFLASH_WriteBytes' was not declared in this scope sFLASH_WriteBytes(values, DESIRED_TEMP_FLASH_ADDRESS, 2); ^ application.cpp: In function 'void loadTemperature()': application.cpp:60:3: error: 'Serial' was not declared in this scope Serial.println("Loading and displaying temperature from flash"); ^ application.cpp: In function 'int setTemperatureFromString(String)': application.cpp:81:3: error: 'Serial' was not declared in this scope Serial.print("Setting desired temp from web to "); ^ application.cpp: In function 'void setup()': application.cpp:117:3: error: 'Serial' was not declared in this scope Serial.begin(9600); ^ application.cpp: In function 'void loop()': application.cpp:139:5: error: 'Serial' was not declared in this scope Serial.print("I2C Status bits are "); ^ application.cpp:161:5: error: 'Serial' was not declared in this scope Serial.print("Potentiometer reading: "); ^ application.cpp:183:7: error: 'Serial' was not declared in this scope Serial.print("Setting desired temp based on potentiometer to "); ^ make: *\ [application.o] Error 1

dmiddlecamp commented 9 years ago

Make sure you're putting the source from "application.cpp" in the main ".ino" file, or add an #include "application.h" at the top of the file to grab Serial and other wiring libraries

I hope that helps!

Thanks! David

aspenarnthors commented 9 years ago

Thanks, this helped a little. There is still an issue with "spark_wiring.h"

See below:

In file included from ../inc/spark_wiring.h:29:0, from Adafruit_GFX.h:4, from Adafruit_GFX.cpp:34: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ In file included from ../inc/spark_wiring.h:29:0, from ../inc/spark_wiring_stream.h:36, from ../inc/spark_wiring_i2c.h:30, from Adafruit_LEDBackpack.h:21, from Adafruit_LEDBackpack.cpp:21: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ In file included from ../inc/spark_wiring.h:29:0, from application.h:29, from thermostat1.cpp:5: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ thermostat1.cpp:13:18: error: variable or field 'setupMatrix' declared void void setupMatrix(Adafruit_8x8matrix m); ^ thermostat1.cpp:13:18: error: 'Adafruit_8x8matrix' was not declared in this scope thermostat1.cpp: In function 'void saveTemperature()': thermostat1.cpp:68:58: error: 'sFLASH_WriteBytes' was not declared in this scope matrix2.clear(); ^ make: *\ [thermostat1.o] Error 1

LinuxSBC commented 8 years ago

How did you get the code into the Web IDE?

towynlin commented 8 years ago

I just gave this a quick try, and it looks like this repo would need some updating to make it work with the Web IDE at build.particle.io. We wrote this code for the Core years ago. Since then our whole platform has moved forward a great deal! The Electron and Photon are much more scalable and friendly architectures. We'd love it if someone in the community would take a crack at updating this repo to work in the Web IDE for the Photon on firmware version 0.5.2!

You would probably want to start a project in the Web IDE by adding 2 libraries:

Then replace the sFLASH calls with EEPROM usage.

From there, just a little debugging and maybe some more recent hardware from Adafruit would probably do it.

Cheers!

LinuxSBC commented 8 years ago

I'm now using Particle Dev for this now and I can get in there and running but there are a few errors (it needs to be updated for the Photon and newer software, like you said).