Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warning and add missing includes in unit test environment #4747

Merged
merged 9 commits into from
Aug 20, 2024

Conversation

gudnimg
Copy link
Collaborator

@gudnimg gudnimg commented Aug 6, 2024

This PR fixes a few issues I noticed when attempting to create unit test for printer model checks in util.cpp/h.

@gudnimg gudnimg requested review from leptun and 3d-gussner August 6, 2024 10:36
Copy link

github-actions bot commented Aug 6, 2024

All values in bytes. Δ Delta to base

Target ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
MK3S_MULTILANG 0 0 247736 5653 6216 2539
MK3_MULTILANG 0 0 247050 5662 6902 2530

@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 6, 2024

I think it would be useful to start stubbing the EEPROM functions... they are easily getting in the way :)

@gudnimg gudnimg marked this pull request as draft August 6, 2024 13:00
@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 6, 2024

Draft... I'm gonna add a few more simple fixes. (Like missing stdint include)

@gudnimg gudnimg force-pushed the minor-fixes-for-future-tests branch 2 times, most recently from 0331f43 to a23b7bc Compare August 8, 2024 15:00
@gudnimg gudnimg changed the title Fix two compiler warnings in unit tests environment Fix compiler warning and add missing includes in unit test environment Aug 8, 2024
@gudnimg gudnimg marked this pull request as ready for review August 8, 2024 15:12
@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 8, 2024

Opening PR up for review.

@gudnimg gudnimg added this to the FW 3.14.1 milestone Aug 8, 2024
@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 8, 2024

Note for future self... try to remove ultralcd.h include from util.cpp or the code being unit tested. ultralcd.h is a can of "mock" and "stub" worms.

gudnimg added 6 commits August 9, 2024 14:57
Prusa-Firmware/tests/../Firmware/util.h:114:25: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  114 |         pStrEnd = strchr(this->ptr, '"');
      |                   ~~~~~~^~~~~~~~~~~~~~~~
      |                         |
      |                         const char*
The following error is raised in unit testing environment:

Prusa-Firmware/Firmware/Configuration.h:16:14: error: ‘uint16_t’ does not name a type
   16 | extern const uint16_t _nPrinterType;
Fixes compiler warning in test environment:

Prusa-Firmware/Firmware/eeprom.h:712:51: error: ‘size_t’ has not been declared
712 | bool eeprom_is_initialized_block(const void *__p, size_t __n);
      |
The file is calling eeprom_read_byte and should include avr/eeprom.h
Place system includes on top
@gudnimg gudnimg force-pushed the minor-fixes-for-future-tests branch from 826ddbf to 0153eb0 Compare August 9, 2024 14:57
We should only be including it where needed
Only include it where needed
@3d-gussner 3d-gussner merged commit f64f2bb into prusa3d:MK3 Aug 20, 2024
4 checks passed
@gudnimg gudnimg deleted the minor-fixes-for-future-tests branch August 20, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants