colonelwatch / ESP32-fluid-simulation

Interactive fluid simulation using the "CYD" dev board, featuring an ESP32. Built in Arduino.
MIT License
22 stars 1 forks source link

I'm not sure what is wrong here #2

Open engares opened 8 months ago

engares commented 8 months ago

I'm not sure what I'm doing wrong. I'm using the 2.0.9 ESP32 Arduino core as recommended. Thanks in advance!!


In file included from C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:3:
c:\Users\krick\Desktop\ARDUINO\libraries\TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
        ^~~~~~~
In file included from C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:6:
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\iram_float.h: In constructor 'iram_float_t::iram_float_t(float)':
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\iram_float.h:14:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             : _value(*reinterpret_cast<volatile uint32_t*>(&value)) {}
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\iram_float.h: In member function 'iram_float_t::operator float() const':
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\iram_float.h:24:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             return *reinterpret_cast<float*>(&a_raw);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino: In function 'void sim_routine(void*)':
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:112:91: warning: missing initializer for member 'stats::point_timestamps' [-Wmissing-field-initializers]
   struct stats local_stats = (struct stats){ .max_abs_pct_density = 0, .refresh_count = 0 };
                                                                                           ^
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:112:91: warning: missing initializer for member 'stats::current_abs_pct_density' [-Wmissing-field-initializers]
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino: In function 'void touch_routine(void*)':
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:99:43: error: 'last_coords.Vector<short unsigned int>::y' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           .y = ((float)current_coords.y - (float)last_coords.y) * 1000 / POLLING_PERIOD};
                                           ^~~~~~~~~~~~~~~~~~~~
C:\Users\krick\Desktop\ARDUINO\ESP32-YELLOW_DISPLAY\ESP32-fluid-simulation-master\ESP32-fluid-simulation\ESP32-fluid-simulation.ino:98:43: error: 'last_coords.Vector<short unsigned int>::x' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           .x = ((float)current_coords.x - (float)last_coords.x) * 1000 / POLLING_PERIOD,
                                           ^~~~~~~~~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors

Using library SPI at version 2.0.0 in folder: C:\Users\krick\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\libraries\SPI 
Using library TFT_eSPI at version 2.5.34 in folder: C:\Users\krick\Desktop\ARDUINO\libraries\TFT_eSPI 
Using library FS at version 2.0.0 in folder: C:\Users\krick\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\libraries\FS 
Using library SPIFFS at version 2.0.0 in folder: C:\Users\krick\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\libraries\SPIFFS 
Using library XPT2046_Touchscreen at version 1.4 in folder: C:\Users\krick\Desktop\ARDUINO\libraries\XPT2046_Touchscreen 
exit status 1

Compilation error: 'last_coords.Vector<short unsigned int>::y' may be used uninitialized in this function `[-Werror=maybe-uninitialized]`
engares commented 8 months ago

I have just realized that I have a 2 USB CYD. There's any way of making it work? Thanks in advance and sorry for the dumbness.

colonelwatch commented 8 months ago

I don't see why having the 2-USB version of the CYD would stop this program from working, so long as you have the right User_Setup.h.

I'm looking at this forum thread at https://forum.arduino.cc/t/esp32-unused-variable-compile-error/1039022/15 and I'm seeing that the reason why compiler warnings are becoming compiler errors is that the setting "File" > "Preferences" > "Compiler warnings" is set to "More" or "All".

The pointer hacks I used will trigger warnings, but I do really need them. To get this to compile, can you try setting "Compiler warnings" to "None"? Of course, you can switch it back when you're done.

Edit: screenshot image