Xinyuan-LilyGO / T-Watch-2021

MIT License
82 stars 18 forks source link

Errors while attempting to compile "SmartWatch" code #4

Closed H3RB4LS closed 2 years ago

H3RB4LS commented 2 years ago

Hello, I recently purchased a 2021 T-Watch (as well as a 2020 V3). I really enjoy them, however I've been having a bit of a problem trying to get the "SmartWatch" folder from T-Watch-2021/Software to compile. I've managed to get others OS' such as the 'sharandac' fork to compile and flash with success. But I'd like to get the OS that is on the watch (the modified version of OSW) to compile so I can modify it to my liking. I've followed just about every tutorial and step I could find but the steps are a bit hazy as the original OSW (Open Smart Watch OS) requires the cofig.h and config_defaults, while the T-Watch version doesn't include them. Trying to do so results in more errors. I've selected the platform environment to the corresponding version, yet I'm always getting some errors while trying to compile. At the moment I'm getting these here

VirtualBoxVM_u3jumIBlzD

Even trying to remove those files with the errors will just bring up more afterwards. I'm quite possibly missing something and any assistance is greatly appreciated.

Please let me know if there's any thing I could do to get the "SmartWatch" code compiled with success to upload. Not just flashed, I've successfully re-flashed the watch using the ESP Flash Download Tool and the target.bin file from the SmartWatchFirmware folder, that worked ok. But I'm interested in getting the entire existing code compiled so I can try to modify bits and pieces as I prefer the OSW style OS vs the sharandac fork which isn't really optimized at all for the round 2021.. Also, is there any Discord channel for TTGO/LilyGo products, just wondering. Thanks for your time.

LilyGO commented 2 years ago

Hi, I have retested while uploading. Compiled without any errors. I don't know what caused the error reported by your compiler. Please help me to paste all compilation error messages on it Snipaste_2022-07-11_09-20-09

LilyGO commented 2 years ago

image config.h, The file modified is the information of connecting to WIFI. You can modify it to your own device information

LilyGO commented 2 years ago

Please help me to reproduce your error condition

criptych commented 2 years ago

Encountered this problem as well. It looks like the include/config.h.example file mentioned in the README is .gitignored (also indicated in @LilyGO's screenshot by the filename color).

Update: I created a config header myself, based on the one from Open-Smartwatch upstream and screenshot above, but now I'm getting an error that the Adafruit_BME280 library cannot find the header "Adafruit_I2CDevice.h".

H3RB4LS commented 2 years ago

image config.h, The file modified is the information of connecting to WIFI. You can modify it to your own device information

This config.h file you have shown here, I do not have that nor can I locate where it is. The only config files I can find are the original config_defaults.h & config.h.example OSW versions that aren't compatible/the same as the one you have displayed here so I can't configure anything and thats why I believe I'm getting this error. The config.h is not in the "/include" folder and I'm not sure where to find it or copy it from. I've tried again and still getting the same error. I haven't done anything to the /SmartWatch folder.

image

I appreciate taking your time to try to help resolve this, hopefully I'll get it sorted but it's not a huge deal, just something I wanted to figure out.

image ( Note: No config.h file present just like on the https://github.com/Xinyuan-LilyGO/T-Watch-2021/tree/main/software/SmartWatch/include page.

Also note the config.h listed under gitignore (https://github.com/Xinyuan-LilyGO/T-Watch-2021/blob/main/software/SmartWatch/include/.gitignore) as mentioned by criptych )

Again, these are the errors shown, more start to pile up but they're in regards to these 'not declared in scope' which is referencing the code in the config.h file that I don't have/can't locate. I'm pretty sure that's where my issue is. If you could point me to the config.h file that I need, I'd appreciate it. Thank you again for taking your time to try to help.

H3RB4LS commented 2 years ago

Encountered this problem as well. It looks like the include/config.h.example file mentioned in the README is .gitignored (also indicated in @LilyGO's screenshot by the filename color).

Update: I created a config header myself, based on the one from Open-Smartwatch upstream and screenshot above, but now I'm getting an error that the Adafruit_BME280 library cannot find the header "Adafruit_I2CDevice.h".

I see that "config.h" is typed in gitignore, but forgive me as I'm not really the best with programming and have no idea what that means. Is the file being ignored? Was it possibly left out? Is it "there", I just don't know how to get it? I think that's my problem. I also tried using the OSW ones (renaming, tried both, combined/ modified etc) and while it got rid of the 'not declared in scope' errors it obviously threw up more relating to different hardware due to the difference from Pauls version and this one. (I believe it was similar if not the same errors you had there). I think that the config.h is the key here but I'll wait and find out. Thanks for your input.

criptych commented 2 years ago

Is the file being ignored? Was it possibly left out?

Yes, files listed in .gitignore are excluded from commits, so even though it exists on @LilyGO's machine as in the screenshot, it wouldn't get uploaded to GitHub (or wouldn't get updated, if it had been uploaded already).

I'm not familiar enough with PlatformIO to be sure what's causing these new errors; it auto-installs the required libraries, but seems like it isn't compiling with the right include directory(ies).

Waiting as well, may see if I can get this to build with plain Arduino in the meantime.

criptych commented 2 years ago

Based on this conversation, I was able to build with PlatformIO by adding the following line to platformio.ini:

lib_deps =
    adafruit/Adafruit Unified Sensor@^1.1.4
    adafruit/Adafruit BME280 Library@^2.1.1
    adafruit/Adafruit BusIO@^1.6.0 ; add this line
    makuna/RTC@^2.3.5
    bblanchon/ArduinoJson@^6.17.3

So no need to dig too deep into rearranging things for Arduino, thankfully.

H3RB4LS commented 2 years ago

Interesting. I'm not sure exactly what you did pertaining to the config.h file. I tried just adding that line in platformio.ini and re-compiling but I still got the same error first mentioned. So then I took the OSW original config_defaults.h & config.h.example (renamed config.h.example to config.h like mentioned in a tutorial, but I'm pretty sure thats for OSW). Still got errors. So then I tried removing the config_example.h (that i had renamed) and then just renamed the config_defaults.h to config.h and it actually compiled: image

Albeit with some errors here and there: image

I appreciate your input though as this is further than I managed to get on my own. Seemingly adding that line to the .ini managed to get it compile using the renamed OSW config file.

I'm still not really sure the way I did it is the right way to go about it though as I don't know if all these errors are present when @LilyGO compiles it. But from a double check, it looks like they had "15" 'problems' next to output as well so this may be about right. Although this "worked", just wanted to check that is in fact the most optimal way to do it.

I'm still hoping they can share/upload the exact config.h file that they have on their machine so I can double check results vs this. No rush but please let me know when you get a chance @LilyGO. Even just copying the entire config.h and sharing the contents would be helpful. As for updating the github with that config.h and removing it from the gitignore list may be a good idea.

LilyGO commented 2 years ago

I will upload the CONFIG.H of my local machine, I hope it will help you

https://github.com/Xinyuan-LilyGO/T-Watch-2021/blob/main/software/SmartWatch/include/config.h

LilyGO commented 2 years ago

In addition, I will upload this project in the form of a compressed package, so that you can use it to compare the differences between the files.

https://github.com/Xinyuan-LilyGO/T-Watch-2021/blob/main/software/SmartWatch.zip

H3RB4LS commented 2 years ago

In addition, I will upload this project in the form of a compressed package, so that you can use it to compare the differences between the files.

https://github.com/Xinyuan-LilyGO/T-Watch-2021/blob/main/software/SmartWatch.zip

Much appreciated. I tried copying the contents into config.h and for some reason got the same error(possibly needed to clean project). BUT I just tried unzipping the Smartwatch folder and recompiling from scratch and it successfully compiles: image

Just the same as I managed to get after criptych pointed out a few things. So I'm good now, I want to thank both of you for your input/help. Much appreciated.