-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add detection of Mainboard firmware type( Marlin or Smoothieware), auto-detect LONG_FILENAME_HOST_SUPPORT, on-boardSD and serial_always_on option in config file & other bugfixes #663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
I merged your changes made in #663 with the master branch (you committed few days ago) and made a review of the code in particular I focused my attention to the parameters you made configurable by file and which constants (such as FAN_NUM, TOOL_NUM etc...) you replaced with the variable you load from file or SPI flash.
Attached my changes to your files. Below my explanation:
- the infoSettings.send_cancel_gcode variable was not loaded from config.ini. I added the parameter to the config.ini file and load it on config.c file
- I replaced the FAN_NUM, TOOL_NUM and EXT_NUM instances in all the project files with the infoSettings.fan_count, infoSettings.tool_count and infoSettings.ext_count respectively
- I defined a MAX_FAN_COUNT constant set to 6 (same value as for the existing MAX_TOOL_COUNT etc...) and used it as size for data structures in the project related to fan info
Below some other comments about changes that should also be made on the project:
- the constant HEATER_NUM (currently set to MAX_TOOL_COUNT + 1 = 7), defined as size on some array data structures, is often used in the project as the number of tools to iterate in a "for" instruction (e.g. for (TOOL i = NOZZLE0; i < HEATER_NUM; i++).... ). It should be better to iterate to (infoSettings.tool_num + 1) instead of HEATER_NUM otherwise you risk to provide info for tools not installed on the printer.
- the start, end and cancel gcodes are not stored and read on/from SPI flash and seems they are not executed during printing. E.g. if I abort the print neither the cancel nor the end gcodes are executed. It seems that the structure "printcodes" on the printing.c file is not correctly initialized with the value from infoSettings.start_gcode, infoSettings.end_gcode and infoSettings.cancel_gcode
br
@digant73 Thanks for checking. Still, some of the replacements are missed. I will try to add these corrections as soon as possible. |
no problem. |
@digant73 already fixed it.. just pushing the commit. 👍 |
So far, all the problems I've been having are fixed with your branch now @guruathwal :) For sure this needs to be merged into the master branch. |
@bigtreetech can you merge please? |
Love not knowing anything about coding and reading your guys' progress on squashing the bugs. Thank you! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
I checked all % specifiers in your last committed project (all the project, not just your changes) fixing all possible wrong data read on printf, storeCmd, mustStoreCmd etc.... In particular for all integer types with a size < 32bit (the native integer size on that HW) a casted the variable to (int). This will allow to convert even uint16 (so even uint8, int8, int16 etc...) without loosing their sign.
There were also just few cases were %f was used on an int type. I simply casted to (float) the integer variable. The logic followed by BTT is to prefer the use of int32 or uint32 just because it is the native size (32 bit) compliant to %d specifier. That will avoid them to pay attention on properly casting the variable when used on printf etc..
Fortunately the changes were not so much (just few files). Most of the changes are related to your variables. Please consider to integrate my changes asap, they will ensure at least your code is stable. Remenber to always check the impact in the project if you will have the need to change the type of your data structures (e.g. int to uint16_t. verify if you will need to apply casting due to usage of that variable on a printf etc....)
thanks for the changes. They are better than my suggestions (you changed the % specifier and used promotion). my_sprintf(tempstr, "%d", old_val); old_val has type u32 but you used %d. Maybe %u was the desired specifier |
@digant73 BIGTREETECH-TouchScreenFirmware/TFT/src/User/my_misc.c Lines 67 to 166 in 56f9040
|
right. The chinese comment in the code helped me a lot to understand! |
google helps , but seem the English is before the Chinese comments (I saw this after I posted LOL)
Express integers in character form
For hexadecimal, 10 will be represented as A
Put integer + '0' = ASCII code corresponding to integer
So the result in str is upside down, flip it
Decimal integer
Hexadecimal integer
Floating point
String
…On Fri, May 22, 2020 at 6:22 AM digant73 ***@***.***> wrote:
@digant73 <https://github.com/digant73>
The my_sprintf / my_vsprintf does not have the %u specifier. You can see
below from line no. 94.
It is converting all input values of any size (signed or unsigned) to a
signed int with my_va_arg(p_next_arg, int); at line no. 102.
https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware/blob/56f904000f16f972a5a5ed3b5bfb121fac739023/TFT/src/User/my_misc.c#L67-L166
right. The chinese comment in the code helped me a lot to understand!
Is there any list of possible reported bugs you are checking?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#663 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXKJNPUAGHE2M56DNGZ4SLRSZOAZANCNFSM4M367U5A>
.
|
I was joking about the comment in chinese |
@guruathwal According to the bug reporting no save on EEPROM was made on exiting from ParameterSettings menu, I honestly don't like that a permanent change is made without the user is prompted with a question asking if he wants to proceed to make permanent the changes. Furthermore (as it was in my case) someone could change the settings just for tuning the printer and testing the results (e.g. the steps-per-unit change) before he wants really make them permanent. Just about the bugs and improvements (not related to your PR) I found and fixed in my project that could be integrated in your PR:
All of those fixes/improvements are already on top of your PR, fully tested since several weeks. Please let me know if you would consider to integrate that fixes/enhancements in your PR. I will eventually open a PR for that but this will take longer time to be eventually accepted and integrated in the master branch. |
Can you please add the fixes for using the coder that I suggested in |
@digant73 thank you in advance |
@digant73 I do not have any list of known bugs. I try to fix problems I find while using these devices, or a reported issue on Github or if anyone asks to solve a problem.
That's a nice idea. I never had this as I prefer saving the settings in case I forgot to save after printing or before shutting down / reset.
In the baby-stepping menu, while printing, the max range I had to set is +-1mm, and I never used the probe offset menu. So I do not know much about this bug. If you can share the details and fix, it will be great.
I am integrating the preheat options in the heating menu, so there will be a stop button in heat menu.
I did not add fan stop command as few people suggested to keep fans ON to speed the cooling process. Maybe it will be better to add cooldown command to the config file.
you can share the details or you can open a PR to my Mainstream branch, then it will be added to this PR after merging. |
@guruathwal Thanks for your work! 👍 |
* master: cleanup & fix st7920 simulator (add klipper support) (bigtreetech#705) Add detection of Mainboard firmware type( Marlin or Smoothieware), auto-detect LONG_FILENAME_HOST_SUPPORT, on-boardSD and serial_always_on option in config file & other bugfixes (bigtreetech#663) Aesthetics, language, configuration (bigtreetech#667) Fix send_cancel_gcode in abortPrinting (bigtreetech#672) Fix heater indexes (bigtreetech#670) RU language correction (bigtreetech#701) Fix a few typos and add missing translations (bigtreetech#694)
Good. I added the two functions "menuEepromSave" and "menuEepromReset" on "MachineSettings.c" and "MachineSettings.h", so they can be called by any other file in the project. Inside these functions a check if EEPROM is enabled or not is performed before eventually showing the popup screen. In case EEPROM is not enabled on Marlin, no popup is showed at all and the control is immediately returned to the caller (it is absolutely transparent for the end user).
Yes +-1.00 is the max unit you can use to increase or decrease the step value. But, for example, if you set the unit value to 0.10 and increase the step value to 4.40. After that you set the unit to 1.00 and try to increase the step value, the step value remains 4.40 instead of reaching the limit 5.00. That problem is probably present also on the heating menus but here the problem was pretty easy to be found due to the small range of admitted values. About ProbeOffset, in addition to the bug on value range already discussed for BabyStep, a more important bug was also discovered and solved. The bug consisted on not resetting to 0.00 the babystep value every time a change on Z offset value is performed on the ProbeOffset menu.
Ok, However attached you can also find my improvements for "Fan.c" and "PreheatMenu.c".
As usual attached you can find all the files affected by my bug fixes and improvements. |
zip file attached on my last reply to guruathwal |
@digant73 |
Hi, I've tried to update my TFT35 with this but it still doesn't seem to detect the mainboard firmware type (so I'm getting cold extrusions when slicing with prusaslicer), is there something special I need to do with my Marlin config? I'm using the TFT35 V3 E3 with an SKR Mini E3 V1.2 |
…to-detect LONG_FILENAME_HOST_SUPPORT, on-boardSD and serial_always_on option in config file & other bugfixes (bigtreetech#663) * Add detection of Mainboard firmware type * fix minor bugs * Fix LCD brightness value display in listview * prevent settings from resetting after config update * add option in config file to force sdcard in non marlin firmware * Add serial always on in config file & add missing hotend_count in config file. * Fix Fan max speed setting and Preheat temperature update through config file * fix machine parameters not saving * remove duplicate entries * Fix tool count and fan count * Add auto-detect Long file name support * allow negative values in machine size * improve print codes * fFix pause resume g-code * fix printf fomattings
Smoothieware does not support M115 Detailed reporting. Hence some settings need to be enabled or disabled in TFT for Smoothieware.
Resolves #668 , resolves #651, resolves #626 , resolves #698