Registration Notice

Due to increased spam, forum registration must be manually approved by a moderator! Please see this post for instructions.

*

Offline vonTirpitz

  • 30
  • Panzer, vorwärts!
    • View Profile
  • Wilmington NC
Well I'm back after a two week coding binge on a project for work.  Sheesh.

Now I can go back and play with everything OP again.  I wonder if there are any Hobby King updates?

Quote
"Personally, I liked the university. They gave us money and facilities, we didn't have to produce anything! You've never been out of college! You don't know what it's like out there! I've WORKED in the private sector. They expect results".

- Dr. Raymond Stantz
"The two most powerful warriors are patience and time."

                                                                 -LT

*

Offline LukeZ

  • 1241
    • View Profile
  • France
I wonder if there are any Hobby King updates?
No updates from HK yet. Originally they said production in February and then I contacted them earlier this month and they said they were still goofing off. Communication with them is not great.

As soon as I know something, it will definitely be publicized.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline vonTirpitz

  • 30
  • Panzer, vorwärts!
    • View Profile
  • Wilmington NC
Re: Setting up a software development environment and other random experiments
« Reply #32 on: November 20, 2017, 06:15:47 PM »
Alrighty then.  Long time between posts.   ::)

Hobby King ran a sale a week or so ago and I saw they had the TCB on sale so I pulled the proverbial 'trigger' and ordered two for $35 apiece.  Shipping and handling wasn't too bad at just under $8 considering they shipped from HK I think. 

The boards and accessories were well packaged and came with a printed quick start guide (from the OP site).  A quick glance at the pcb looked to me like they have replaced the MOSFETs so I am hopeful that I won't have to modify either board. 

I plan to fire up my development software and test the boards this weekend.  I'll post as I make progress.  Thanks Luke!





"The two most powerful warriors are patience and time."

                                                                 -LT

*

Offline LukeZ

  • 1241
    • View Profile
  • France
Re: Setting up a software development environment and other random experiments
« Reply #33 on: November 21, 2017, 01:05:13 PM »
Long time between posts but you also skipped all the drama from this summer so just as well. Good luck on your tinkering and I will be interested to hear how you get along.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Heclo

  • 18
    • View Profile
Re: Setting up a software development environment and other random experiments
« Reply #34 on: October 07, 2020, 02:01:50 AM »
I have gotten a Qt environment up and running thanks to this thread and I have managed to compile a working OP Config.exe
however not being familiar with anything but arduino code (and other micro controller level code, being an electronics engineer)
I have trouble figuring out how the parameter data go from the OP config to the TCB.

Where is the variables stored before being uploaded to the TCB?

How does the TCB recognize the data?

I would like to add entirely new settings to the OP Config, settings related to my own TCB design.
I have tried making copies of existing combo boxes and spin boxes but I'm not completely sure I'm on the right path.

This is what I've tried thus far:

I want a spin box in the Motors tab, with the setting for motor watt output, this should change a public variable in the OP_Driver class


Best reagards Kim
Mainwindow motor.png
Setting up a software development environment and other random experiments Mainwindow motor.png
Views: 6272
OP_Driver_cpp.png
Setting up a software development environment and other random experiments OP_Driver_cpp.png
Views: 2117

*

Offline Heclo

  • 18
    • View Profile
Re: Setting up a software development environment and other random experiments
« Reply #35 on: October 07, 2020, 02:15:13 AM »
Attached the wrong picture to the post above..

Here is OP_Driver.h
OP_Driver_h.png
Setting up a software development environment and other random experiments OP_Driver_h.png
Views: 1624

*

Offline LukeZ

  • 1241
    • View Profile
  • France
Re: Setting up a software development environment and other random experiments
« Reply #36 on: October 07, 2020, 12:10:48 PM »
Hi Kim, my apologies for not replying earlier. Fortunately the process is not difficult but there are many steps.

All variables passed to the TCB will be stored in EEPROM on the device chip, and all of the several hundred EEPROM variables are stored in a single "struct." The first thing to do is open the Excel file I have included in the source code (source for the TCB, not OP Config). It is in the \src\OP_EEPROM\ folder and is called OP_EEPROM_Vars.xls

On the first tab "eeprom_data" is where we keep track of all our variables and their IDs. You will want to create a section for Heclo variables, you can pick a gap in the ID list, for example there are no variables starting with 23xx so that might be a good place to put them. I would start with number 2311 and go up from there (if you have more, or need to add more in the future). These need to be inserted between the 22xx and 24xx series variables in the Excel file.

Your variable looks to be defined as a double (same thing as a float on Arduino) but I think you can probably get away with a uint8_t since the value is just a number between 0-200.

In your new row on the Excel spreadsheet you need to enter the values for columns D, G, K, L and optionally M. Column K will be the variable name and this will need to match exactly what is in Arduino (which we will put somewhere else, described below). In your case it looks like the name will be "engine_max_watt"

When you insert a row in the Excel table the formulas in the grey columns will not automatically adjust (C, E, F, H, I, J) so you will need to drag the formulas down from a higher row all the way to the bottom of the sheet so that is corrected. (I hope this makes sense)

Ok great, the "eeprom_data" tab has been adjusted, now we can use the two other sheets to give us the code we need to copy into both the TCB and OP Config firmware.

The Excel tab named "For OP_EEPROM_VarInfo.h" will of course provide the array code for the \src\OP_EEPROM\OP_EEPROM_VarInfo.h (in the TCB firmware) and the tab named "For_QT" will provide the array code for "op_eeprom_varinfo.h" in the OP Config source code (under the Headers section in QT Creator).

But again, since you manually inserted a row in Excel these two sheets will need to have the list repopulated, just select cell B4 and click the little square at the lower right corner and drag it down until you have the complete list at the bottom (hopefully you are familiar with Excel).

Ok, now you need to copy those arrays to the TCB and OP Config firmware in the files I just mentioned above. When you open those files you will see what area needs to be pasted over. ALSO - you need to update the #define NUM_STORED_VARS in both files. This number is calculated for you in Excel. I believe the number now is 331 so if you add 1 more variable it should calculate to 332 if you did everything correctly.

Great, that's step 1!

Now let's tell the TCB firmware about this variable.

Open the \src\OP_EEPROM\OP_EEPROM_Struct.h file in the TCB firmware. You need to create your variable here, and it has to be the same datatype that you defined in the Excel sheet, and it has to show up in the same location. So for example if you created in a new section 23xx between "Smoker settings" and "Driving Adjustments" then in this .h file you will want to define your variable here like so:
Code: [Select]
... etc ...
    uint8_t HotStartTimeout_Sec;

// Heclo variables
    uint8_t engine_max_watt;

// Driving adjustments
    boolean AccelRampEnabled_1;               
... etc ...

Now do the same thing to the \src\OP_EEPROM\OP_EEPROM.cpp file (look way down near the bottom), only this time use the "ramcopy." prefix before your variable name, and give it whatever default value you want (this should be the same as the default value you assigned in the Excel), like so:

Code: [Select]
... etc ...
        ramcopy.HotStartTimeout_Sec = 0;       

    // Heclo variables
        ramcopy.engine_max_watt = 100;       // engine_max_watt default set to 100

    // Driving adjustments
        ramcopy.AccelRampEnabled_1 = true;     
... etc ...

Ok, we are nearly done with the TCB side of things. In the Arduino sketch you can access your variable by the name "eeprom.ramcopy.engine_max_watt" But you don't really need the variable in the sketch, you want it in the OP_Driver class, so I'd just add it to the class begin() statement, and then pass it to the class from the sketch where the Driver.begin() call appears (around like 284 in my copy, on the first tab in the Sketch, this is under the Setup() section). There are already several other eeprom variables passed to that class so you can easily see how to add another one.

Great! Now you have the variable passed to the OP_Driver class and you can do whatever you want with it in the class begin function (typically save it to a local class variable and then refer to it in your class functions).

Ok, one more thing on the TCB side - go back to the \src\OP_EEPROM\ folder and open up the "OP_EEPROM.h" file. Near the top you will see a define called "#define EEPROM_INIT" set to some 4-digit hex number. Change this number, it doesn't matter what to, just so long as it is different. This will cause the firmware to force an eeprom reset on the next boot after you flash this firmware, so that it can wipe the old eeprom values and adjust for the new one you added. This 4 digit number will itself be saved to eeprom so on subsequent boots it will skip the reconfiguration (which deletes all the saved values), but anytime you change the number a reconfiguration will occur. So the first time you flash any firmware that has new eeprom variables added to the source doe, you need to change this INIT number.

At this point you probably want to change the firmware version number too! This is done in \src\OP_Settings\OP_Settings.h

This post is getting pretty long, so I will do another one about how to wrap up the OP Config side of things.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline LukeZ

  • 1241
    • View Profile
  • France
Re: Setting up a software development environment and other random experiments
« Reply #37 on: October 07, 2020, 01:02:09 PM »
Ok, now for OP Config. You have created a spin box where the user will enter some number. We need to get that to the TCB.

We need to create a variable to hold this value in OP Config. This will be done in the file "op_devicedata_struct.h" (under the Headers section in Qt Creator). Similar to what we did with the TCB, we need to add a variable here, you would add it like this:

Code: [Select]
... etc ...
    uint8_t HotStartTimeout_Sec;

// Heclo variables
    uint8_t engine_max_watt;

// Driving adjustments
    boolean AccelRampEnabled_1;         
... etc ...

Now we have two files, the first one will handle copying the value from the spin box to the variable, and the other way around, copying the value from the variable back to the spin box. This file is called "mainwindow_varcontrols.cpp" (under the Sources section in Qt Creator). The first function in this file is called Variables_to_Controls(). Find the Motor tab section and add something like this:
Code: [Select]
ui->spinMotorWattage->setValue(DeviceData.engine_max_watt);

Keep scrolling down that same file and you will find a second function called Controls_to_Variables(). Again find the Motors tab section and add something like this:
Code: [Select]
DeviceData.engine_max_watt = ui->spinMotorWattage->value();

Now let's go to the second file, which will handle copying the variable to the array that gets sent to the TCB when writing, as well as the other way around to copy the value from the array back to the variable (for when the TCB writes to OP Config). The first function is called VarArray_to_Variables(). Scroll down to where section 22xx ends and before 24xx begins, and add this (I am assuming you gave your variable the ID 2311 in the Excel at the beginning):
Code: [Select]
DeviceData.engine_max_watt = VarArray.value(2311).toUInt();

Keep scrolling down that same file and you will see a second function called Variables_to_VarArray(). Again find the correct section, and add this:
Code: [Select]
VarArray.insert(2311, QByteArray::number(DeviceData.engine_max_watt)); 

I think that should be all. Sometimes we need to add user interface handling if we need to show/hide the spin box based on other selections, but in your case I don't think that is necessary.

You will want to change the version number of OP Config as well, this is done in version.h. It needs to be updated in about 5 places in that file, including VER_MINTCB_STR
which you should set to whatever version you set your TCB firmware to.

To make sure the version number gets applied whenever I change it, in Qt Creator I do the following three steps from the Build menu:
1. Clean All
2. Run qmake
3. Rebuild all

Ok, now you can test everything out! It's possible I have forgotten a step somewhere so if you have issues let me know, but I hope this information gets you further along anyway.



NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Heclo

  • 18
    • View Profile
Re: Setting up a software development environment and other random experiments
« Reply #38 on: October 08, 2020, 07:44:48 AM »
Luke! You're a star!

Thanks for the detailed walktrough, it worked in the first try, I was kinda perplexed  ;D

Before I move on with the modding, do you have a repository for the 0.93.71 version? The one with Onboard driver C and D integrated.
I just went ahead and tested with version 0.93.70  ;)

Have a great day, Kim

*

Offline LukeZ

  • 1241
    • View Profile
  • France
Re: Setting up a software development environment and other random experiments
« Reply #39 on: October 08, 2020, 12:23:09 PM »
The version 0.93.70 is what's posted on the website now, so yeah we have a copy of it. After you feel like you have a stable version on your end with your various changes, you can send me a new hex and I will post that, but at that point you do want to be sure to update the version number. Go ahead and take your time on it, it is of course better to wait and be sure you have everything added that you want, than to post a whole bunch of versions...
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline NS-21

  • 53
  • dreamer
    • View Profile
Some time ago (oh, how long ago it was), I asked my beloved LukeZ if it was possible to make a Russian version of the help and a configuration program.

LukeZ said that many have tried, but usually forgotten and failed.

And what can I answer you?

I figured it out in Qt! And I succeed!

Many thanks to LukeZ, vonTirpitz for detailed explanations on setting up the development environment and more.

My path was very thorny.
I downloaded the OP Config source code from github and without a second thought downloaded the free version (registered) of Qt 6.

I set up a project, I'm trying to build it - the development environment swears at the lack of seralport.
I spent three hours reading both Russian and foreign forums, and it turned out what?
It turns out there is a list of modules that have been removed from Qt 6!

I am reinstalling Qt version 5.9.9.

I edit the code in Russian, run it from the development environment - the program starts, it turns out! I can check the settings of the TCB board, but I cannot flash the firmware!

Wrong COM port speaking.

Yes, I'm not the smartest. For three days I was struggling with this problem, and today I decided to go to the forum to see if people are smarter than me - they described their way.

Bingo!

I uninstall Qt 5.9.9, put the version as specified by the respected vonTirpitz and LukeZ in this thread, voila:

At the moment, I have translated more than 70% of the entire program:

The work continues, I am very glad that I have mastered a new direction for myself.

And now the problems:

1. I want to fully translate the help files. Please nudge me in a direction where I can learn how to compile a help file.

2. It is not yet clear to me what to do with program updates when new versions appear. What conflicts there will be.

P.S. I'm also researching a small sound card based on LukeZ :

1.jpg
Setting up a software development environment and other random experiments 1.jpg
Views: 1368
q8hjwmjR8Dg.jpg
Setting up a software development environment and other random experiments q8hjwmjR8Dg.jpg
Views: 1301

*

Offline LukeZ

  • 1241
    • View Profile
  • France
And now the problems:
1. I want to fully translate the help files. Please nudge me in a direction where I can learn how to compile a help file.
2. It is not yet clear to me what to do with program updates when new versions appear. What conflicts there will be.
Hi NS, I admire your fortitude to have made it this far! That is a lot of work I know.

The help files are in HTML format and can be found in your OpenPanzerConfig QT project directory under the folder called "help_files". The html files are the ones that you would need to translate. Then we have to convert them to "qch" and "qhc" files for OP Config to read them. I have a batch file also in that same folder that will do this for us, it is called "createqhcp_5.4.bat"

You will want to open this bat file in a text editor (you can use Windows Notepad, Wordpad, or whatever). You will need to change the file paths to match where things are located on your computer. There are five lines in this batch (bat) file:
Line 1: This line creates the two files (opconfig.qch and opconfig.qhc) which will be saved to the help_files folder. You probably don't need to change this line.
Lines 2-5: These lines just copy those two files to two other folders where we need them. The first pair of lines copies them to the Release folder of the compiled program, so that they will show up when you run OP Config from Qt. The second pair of lines copies them to a folder in my InnoSetup directory so they can be referenced by InnoSetup when it creates an installation package of the program. Maybe you have not gotten that far yet. Anyway, the paths in these 4 lines are for my own system so you will have to change them to whatever your directories are.

Once that is done and you save the bat file, then after you make any change to any HTML file all you have to do is double-click on the "createqhcp_5.4.bat" and it will update the qch and qhc files and put copies of them where needed.

You might also notice a "createqhcp_5.6.bat" file, you can ignore that one. It was for testing with Qt 5.6 but as you discovered they removed a lot of features with versions of Qt after 5.4 so I decided not to use them.

As for your second question about program updates when I release new versions. Yes, this will be a challenge. I would like to say that hopefully I will not do many more releases but it seems like there is always something new to change. But you can always view what the changes have been on GitHub, here is the commit page for OPConfig: click here.

If you click on a commit it will show you exactly what lines of code were changed. You will just have to make those same changes to your own copy of OPConfig. It will be a pain in the butt and an eternity of unpaid work, so be careful if you want to go down this path!

I would also recommend that you store your copy on GitHub as well. It is a great tool and lets me go back and see what I have done, not to mention it is a backup in case my computer dies. But of course GitHub is not easy to use (at first) and you have to learn even more new things. I did not appreciate how difficult they made it to use but I do like the ability that it gives me. If you are curious, I use a program called SourceTree to manage uploading the files from my computer to my GitHub account and that makes things a bit easier.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline NS-21

  • 53
  • dreamer
    • View Profile
LukeZ, thanks for the clarification on changing the help files. There is already a little understanding of how this is done.
I will try.

I have already translated the program by 90% (I also need to translate the pictures), now I am looking for all msgBox for their translation, and I cannot understand where they are
such variables \ labels:

1. Not connected
2. Connected to COM3 (115200) TCB Firmware 0.93.74
3. When there is a call to the function of resetting the entered settings in the program to default values ​​- I can not understand where the data for translating the Yes \ No buttons is located
4. I also probably found a bug in Qt. More details:

I installed hot keys on the program menu functions, as it is very convenient when configuring the board - load with two buttons - read the settings from the board, save to the OPZ file.

On the menu function "Import settings" I have set the group of buttons Ctrl + I. In the mainwindow.ui file open in the development environment, I see with my own eyes that the group of buttons is set to Ctrl + I.

But when I build the project and run it from the relase folder, I get the result as in the picture. The hotkeys for this item are set to Ctrl + O.

In principle, I can ignore it, but my inner perfectionist gnaws at my heels.

P.S. I also feel I have to tinker with InnoSetup, I installed it on my computer, but I haven’t tried to play with it yet, making a trial assembly of the installer.
However, I think there should not be any big difficulties, most likely there you need to specify what and where to install.

Also need to study Github, and here is this point with tracking changes. I suspected there were features like comparing versions and showing changes.
I guess that Github is most likely arranged like a Wiki, most likely it is impossible to break-harm, but I don't want to disgrace myself ^ _ ^

The most important thing that pleases me is that I look into the structure of the source code - and I understand what and how it works. Everything is very logical and understandable.
For me, this is a great joy and achievement, because some time ago, I looked at the code like a ram at a new gate (Russian proverb).

As for It will be a pain in the butt and an eternity of unpaid work, so be careful if you want to go down this path!

It pleases me. It is very exciting and interesting.

1.jpg
Setting up a software development environment and other random experiments 1.jpg
Views: 383

*

Offline NS-21

  • 53
  • dreamer
    • View Profile
LukeZ, thx, I figured out how to translate help files, the process is ongoing, everything is clear, except for:

How do I translate the area I have highlighted in red?
Thanks in advance for the hint.


*

Offline LukeZ

  • 1241
    • View Profile
  • France
Hi NS, I just wanted to let you know I have seen your posts and I think I can help you with all the questions so far. I don't have very much time right now but I will write you a better response this weekend. I will also give you my Inno Setup files which should make it easier for you to create an installation package.

However I can answer your last question about the navigation menu in the help assistant - you can find that in the "\help_files\opconfighelp.qhp" file. It has a "qhp" extension but it is just a standard XML file so you can edit it with Notepad or whatever. The table of contents text is at the top within the <toc> ... </toc> tags. You just need to change the "title" attributes.

When you are done run the batch file that I talked about earlier and that will update your changes. 
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs