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

Nextion touchscreen and limit switch support, ported to CCS 10 and C2kW 3.02 #82

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

kentavv
Copy link

@kentavv kentavv commented Aug 29, 2020

This PR adds Nextion support while maintaining the seven-segment display. Also adds a limit switch, useful for stopping travel using a carriage or bed mounted switch. During development, code was ported to latest Code Composer and local copy of C2000Ware removed and local copy referenced.
More details and improvement suggestions available https://youtu.be/AzoYlNzwKkY and https://kvvcreates.com/nextion-touchscreen-for-clough42-electronic-leadscrew/

@reedb
Copy link

reedb commented Sep 25, 2020

Could you say anything about the nature of the changes needed to work with CCS 10 and C2kW? I think other users would find this useful. When I try to compile the existing code on CCS10 I'm hitting:

**make: *** No rule to make target 'clean'.  Stop.
"make clean" terminated with exit code 2. Build might be incomplete.**

My CCS10 seems to compile and debug the examples without a problem.

@kentavv
Copy link
Author

kentavv commented Sep 25, 2020

@reedb It's a while since I did this part, and this was my first time using CCS, so there might be a more correct way. If I remember correctly, I built a new CCS10 project and imported the source code (creating the new .project and .cproject file, which might solve your immediate problem). Then removed the local copy of the c2k files, replacing them with ones dragged in from the installation from c:\ti. If all is installed correctly, there's an option in the project's settings for importing the c2k ware, might be a tab called Products under the CCS General options. Once compiling as a COFF binary, I merged the original *_lnk.cmd files with ones from newer examples to add ELF support and get RAM and FLASH targets working. I didn't use the test jig, but I would hope it's easier to get working than the hardware. As an alternative approach, you might try compiling the feature-nextion branch, then strip out the Nextion stuff if you don't want it and then compare to main branch. I think at that point, in the main code, you'll only see one section in the UI loop where I needed to rearrange the order a little.

@clough42
Copy link
Owner

I would like to move to CCS10 at some point, but I'm probably not going to be able to merge this code directly due to other things that have been refactored and the number of files touched.

I'll leave this PR here for the time being as a reference.

@kentavv
Copy link
Author

kentavv commented Oct 11, 2020

@clough42 This patch adds a touchscreen alternative that coexists alongside the seven-segment display, and I may branch off this patch to create a pure touchscreen version. A CCS10 port referencing the local c2kWare probably would be pretty quick for someone who has previously used CCS. Not me, I stumbled around a lot to get a working environment :) Based on change stats only, looks like an earlier PR might have done this too? If you have questions about the CCS10 port part, I may be able to help, but probably best to recreate that as a standalone change. Peace

@clough42
Copy link
Owner

Unfortunately, I'm no expert in the CCS environment, either. I have consulted with a a couple of people who use it professionally, and got similar disclaimers. :)

My goal was to get something repeatable that would be easy for people to use, and what's out there on master/dev now is the result. At the moment, I want to keep it as easy as possible for people who previously compiled and installed an earlier version to update to the latest (soon to be 1.3.01) so they can get past any reliability issues they're experiencing with the control panel. A CCS10 update, or something more version independent could come in the future.

Are you planning on making the Nextion project files available? I think I saw that you published only the compiled binary?

I have now refactored the input routines somewhat to solve input reliability issues, and I haven't checked to see what that does to your code. My original intent was to isolate all of the user interface code into the UserInterface class so it could later be split into multiple subclasses for different user interface technologies (UserInterfaceLedAndKey, UserInterfaceNextion, etc.) This would be a typical dependency injection pattern, though simplified and hard-coded to work in microcontroller code.

I don't know if all of the interfaces are in place to make that work correctly at the moment. The main issue would be that the UserInterface class has some of the initialization logic (loading the feed tables), and maintains some of the state that should really be in Core. I discovered and fixed some of this when updating the input loop, but I'm sure there's still more that could be done to make it better.

@kentavv
Copy link
Author

kentavv commented Oct 13, 2020

@clough42 I created another pull request that should be more helpful with a port to CCS10 (#97), in branch feature-ccs10.

In feature-nextion, the Nextion files nextion-els.HMI and nextion-els.tft are the Nextion source and binary respectively. Someone could make a nicer looking interface without any coding if they maintain the Nextion variable names.

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.

None yet

3 participants