WLED icon indicating copy to clipboard operation
WLED copied to clipboard

Usermod TetrisAI compile error

Open robertvb83 opened this issue 1 year ago • 14 comments

What happened?

@muebau

I am not able to compile WLED 0.15 with -D Usermod_TetrisAI

To Reproduce Bug

compile latest 0.15 branch with VS PlatformIO

with override -D USERMOD_TETRISAI

Expected Behavior

TetrisAI should compile :-)

Install Method

Self-Compiled

What version of WLED?

WLED 0.15.0-b2

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

In file included from wled00/../usermods/TetrisAI_v2/tetrisaigame.h:22:0,
                 from wled00/../usermods/TetrisAI_v2/usermod_v2_tetrisai.h:7,
                 from wled00/usermods_list.cpp:217:  
wled00/../usermods/TetrisAI_v2/tetrisai.h: At global scope:
wled00/../usermods/TetrisAI_v2/tetrisai.h:221:10: error: 'bool TetrisAI::findBestMoveNonBlocking(GridBW, std::vector<Piece>::iterator, std::vector<Piece>::iterator, Rating*)' cannot be overloaded
     bool findBestMoveNonBlocking(GridBW grid, std::vector<Piece>::iterator start, std::vector<Piece>::iterator end, Rating* bestRating)
          ^
wled00/../usermods/TetrisAI_v2/tetrisai.h:206:10: error: with 'bool TetrisAI::findBestMoveNonBlocking(GridBW, std::vector<Piece>::iterator, std::vector<Piece>::iterator, Rating*)'
     bool findBestMoveNonBlocking(GridBW grid, std::vector<Piece>::iterator start, std::vector<Piece>::iterator end, Rating* bestRating)
          ^
wled00/../usermods/TetrisAI_v2/tetrisai.h: In member function 'bool TetrisAI::findBestMoveNonBlocking(GridBW, std::vector<Piece>::iterator, std::vector<Piece>::iterator, Rating*)':
wled00/../usermods/TetrisAI_v2/tetrisai.h:211:17: error: 'expression' was not declared in this scope      
         switch (expression)
                 ^
wled00/../usermods/TetrisAI_v2/tetrisai.h:213:18: error: 'INIT' was not declared in this scope
             case INIT:
                  ^
wled00/../usermods/TetrisAI_v2/tetrisai.h:219:5: warning: no return statement in function returning non-void [-Wreturn-type]
     }
     ^
In file included from wled00/usermods_list.cpp:217:0:
wled00/../usermods/TetrisAI_v2/usermod_v2_tetrisai.h: In function 'uint16_t mode_2DTetrisAI()':
wled00/../usermods/TetrisAI_v2/usermod_v2_tetrisai.h:119:7: error: no match for 'operator!' (operand type is 'TetrisAIGame')
   if (!tetrisai_data->tetris || (tetrisai_data->tetris.nLookAhead != nLookAhead
       ^
wled00/../usermods/TetrisAI_v2/usermod_v2_tetrisai.h:119:7: note: candidate: operator!(bool) <built-in>   
wled00/../usermods/TetrisAI_v2/usermod_v2_tetrisai.h:119:7: note:   no known conversion for argument 1 from 'TetrisAIGame' to 'bool'
*** [.pio\build\custom_build\src\usermods_list.cpp.o] Error 1
============ [FAILED] Took 8.00 seconds ============

Environment    Status    Duration
-------------  --------  ------------
custom_build   FAILED    00:00:08.000
======= 1 failed, 0 succeeded in 00:00:08.000 =======
PS D:\WLED\WLED-0_15> pio run -e custom_buildpio run -e custom_build

Anything else?

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

robertvb83 avatar Apr 06 '24 21:04 robertvb83

Please contact (tag) original author of the usermod.

blazoncek avatar Apr 07 '24 06:04 blazoncek

Hallo @muebau please have a look

robertvb83 avatar Apr 07 '24 07:04 robertvb83

thank you. I will have a look in that but I think some of the newer code sneaked in there and it should be enough to simply remove it.

muebau avatar Apr 07 '24 18:04 muebau

I found the original commit (first working version). I remember there was some problem if the effect was changed often but it is the version I created the PR for. There is a problem to compile it with 0.15b2 at the moment.

How would I fix the code? Should I create another PR?

muebau avatar Apr 12 '24 08:04 muebau

How would I fix the code? Should I create another PR?

Yes.

blazoncek avatar Apr 12 '24 08:04 blazoncek

@robertvb83 I created a version that compiles on a branch: https://github.com/muebau/WLED/tree/fix_usermod_tetisai

Please use this and I will create a pull request later.

muebau avatar Apr 12 '24 10:04 muebau

Edit: I posted nonsense... I used a wrong fork, will test later today

robertvb83 avatar Apr 12 '24 14:04 robertvb83

Thank you

muebau avatar Apr 12 '24 15:04 muebau

FYI

git remote add muebau https://github.com/muebau/WLED.git
git checkout -b --no-track muebau/fix_usermod_tetisai
git pull

and then compile.

blazoncek avatar Apr 12 '24 15:04 blazoncek

It works and is super cool! Unfortunately i cannot get AR, Animartrix and Tetris on one build due to file size exceed error

@muebau Thanks for providing such a cool usermod and thanks for the quick fix!

robertvb83 avatar Apr 12 '24 19:04 robertvb83

ezgif-3-b8ef2e2e0f

robertvb83 avatar Apr 12 '24 19:04 robertvb83

It works and is super cool! Unfortunately i cannot get AR, Animartrix and Tetris on one build due to file size exceed error

Get ESP with 8MB flash or modify partitions,

blazoncek avatar Apr 12 '24 20:04 blazoncek

I created a new PR https://github.com/Aircoookie/WLED/pull/3897

muebau avatar Apr 12 '24 20:04 muebau

It works and is super cool! Unfortunately i cannot get AR, Animartrix and Tetris on one build due to file size exceed error

Get ESP with 8MB flash or modify partitions,

Thanks for the hint. I found a partition file at MoonModules that works. Animartrix, AR, TetrisAI on one 4MP dev board! (Still deactivate IR and mqtt).

WLED_ESP32_4MB_256KB_FS.csv

robertvb83 avatar Apr 13 '24 13:04 robertvb83