Open Panzer

Developer's Forum => TCB Dev => Topic started by: vonTirpitz on January 13, 2017, 06:35:16 PM

Title: Setting up a software development environment and other random experiments
Post by: vonTirpitz on January 13, 2017, 06:35:16 PM
Well it seems I have entered into this hobby at an exceptionally interesting time! 

With the intent of starting a new hobby with my son I recently acquired two new Taigen 1/16 IR tanks (the Panther G and Sherman 75).  Even before we opened the tanks on Christmas day I was looking through the vast amounts of forum information at RC Universe and drew the conclusion that I wanted more control of the tanks and how they interact and are controlled.  I also quickly realized that Danville VA is a focal point for this hobby and is just up the road from us so having a Tamiya compatible battle system became a desire as well.

I wanted to raise and lower the gun via the left control stick and not have it "cycle" up and down (I would find another switch to actually fire the gun).  And from what I read and saw on youtube, I decided that I also wanted more realistic acceleration and deceleration rates.  Even having more and better sound options seemed like a good idea.

The day came when we finally opened the tanks and it was a blast.  I had planned ahead and picked up two 5000mA NiMH batteries and had them charged up to supplement the 2000mA batteries that came with the tanks.  Weather permitting, we ran and battled both tanks for many days.  I ended up purchasing a quad charger just so I could exercise and keep enough batteries up to continue running!

As we played with the tanks I continued reading and learning and just as I was about to put a new wish list together for new hardware somebody said to me "wait a few days for something special".   

So I did and am very glad I waited.

Every time it seems I am ready to look for something new and improved you folks keep delivering.  Thank you!

And now the Open Panzer project! 

I haven't been in a R/C hobby for nearly two decades so I am stumbling along a decently sized learning curve trying to catch up with what happened over the years.  Fortunately, I have been developing embedded software for the better part of thirty years so I have that going for me.  Filling up a forum post with my mostly inexperienced attempts to get what I want might provide a little entertainment to some and perhaps hope to others.    ;D

I downloaded and installed the Arduino 1.8.0 IDE yesterday only to find an update today.  So I will go back and install 1.8.1 and continue my post.
Title: Re: Getting Started
Post by: vonTirpitz on January 13, 2017, 06:45:05 PM
Now before I get too far ahead of myself I just want to explain that all I am attempting to do right now is familiarize myself with the hardware and software as well as get set up to "hit the ground" running once the TCB is actually available.

So please bear with me as I fully expect to run into a few "bumps" along the way.  It is my hope that, while getting guidance from the developer, my posts may also smooth the way for others that join the adventure at a later time.

BTW.  If somebody figures out how to embed links in these posts I would really appreciate it.  <a href="http://openpanzer.org/forum/index.php">Open Panzer</a>  <--- Yikes.  My HTML skills are so lame.... sigh.
Title: Re: Getting Started
Post by: vonTirpitz on January 13, 2017, 07:06:03 PM
The Arduino 1.8.1 IDE (Integrated Development Environment for the uninitiated) is now installed and running.

I have copied the contents of OpenPanzerProject-TCB-2da5dca.zip into the Arduino folder that was created in my documents folder and proceeded to open an Arduino sketch (which in my mind is just another name for project).

Opening the most logical .ino file (OpenPanzerTCB) went well.  It appears that opening any .ino file that was in the folder will load the rest automatically.  Fair enough.

Everything seems intuitive and straightforward.  I will go ahead and select Verify/Compile from the Sketch menu on the toolbar.....

Compiling proceeds smoothly up and until....

After several files compile I start getting an errors that several definitions are not declared in scope.   I'll start digging into this condition.  I've likely not properly configured the compiler.  Will be back as soon as I figure this out!   :o



                                                                           ^
Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

===================I have deleted many lines from the error message to only show the last few lines . ---------------

Utilities:548: error: 'pgm_read_byte_far' was not declared in this scope

         varType = pgm_read_byte_far(pgm_get_far_address(STORAGEVARS) + (i*5) + 4);                                                                                 ^

exit status 1
'Serial1' was not declared in this scope


Title: Re: Getting Started
Post by: vonTirpitz on January 13, 2017, 08:03:17 PM
I'm cheating a little bit by downloading and installing Arduino IDE for Visual Studio as I am much more familiar with VS and can navigate and work in the project (sketch) much faster this way.

Arduino IDE for Visual Studio can be found here:
https://visualstudiogallery.msdn.microsoft.com/069a905d-387d-4415-bc37-665a5ac9caba?redir=0 (https://visualstudiogallery.msdn.microsoft.com/069a905d-387d-4415-bc37-665a5ac9caba?redir=0)

A free version of Visual Studio (Visual Studio Community Edition) can be downloaded here if you do not have a licensed version:
https://www.visualstudio.com/downloads/ (https://www.visualstudio.com/downloads/)

Title: Re: Getting Started
Post by: LukeZ on January 14, 2017, 12:48:02 AM
vonTirpitz, welcome, and thank you for starting the first real thread of this entire website! And thank you for being interested enough in this project to document your experiences.

I've just come in late and I won't write much tonight. But a few thoughts -

As for inserting hyperlinks into your posts - for security reasons this forum (and all other forums) ignore HTML. Instead the forum uses something called BBC, which stands for Bulletin Board Code. So rather than using html tags, to insert a hyperlink do this instead: [url=www.google.com]Google[/url]. Then the forum will render it as Google (http://www.google.com).

BBC is standard across pretty much every forum you might encounter so once you get the hang of it then you can use it anywhere.

You can also just highlight the text you want to make a link in your message, then click on the little globe icon in the message editor and it will help you create the link. There are actually two editing modes - advanced (where you have to enter the BBC yourself), or standard (where when you click on the buttons in the editor it does things for you). You can toggle the editing mode when posting by clicking the button that has an icon of an arrow within brackets. See the image below.

Here's a page (http://forums.tieline.com/help/?area=bbcode) with more detail on all the BBC codes.

More later!
Title: Re: Getting Started
Post by: vonTirpitz on January 14, 2017, 09:24:23 AM
vonT, try reading through again the introductory section of the GitHub page where you downloaded the project: GitHub TCB (https://github.com/OpenPanzerProject/TCB). The reason Arduino is giving you errors when compiling is that it thinks you are trying to compile for the "Genuino Uno" board, but the code is designed for the TCB board. The TCB is based on the Arduino Mega board which uses a different processor. So in the Arduino IDE go to the Tools menu, then Boards, then select Arduino Mega, and it should compile. [/li][/list]

Thank you!  That's what I deserve for just downloading the zip file.  I didn't even go to GitHub to read the notes until now.  lol   ::)


As for inserting hyperlinks into your posts - for security reasons this forum (and all other forums) ignore HTML. Instead the forum uses something called BBC, which stands for Bulletin Board Code. So rather than using html tags, to insert a hyperlink do this instead: Google (http://www.google.com). Then the forum will render it as Google.

And thank you again!  I just have to go back another few years and pull out my old bulletin board memories from the 90s.   :o

Well I did state that I was just stumbling into this....   ;)

I have become a digital dinosaur....

(https://farm1.staticflickr.com/301/32265057246_a31f16b8af_m.jpg)
Title: Re: Getting Started
Post by: vonTirpitz on January 14, 2017, 10:34:43 AM
With the newly absorbed knowledge gleaned from the notes on GitHub I have successfully verified and compiled the TCB code as well as exported a compiled binary.  Huzzah!

It's amazing what can get done if you actually stop to read the instructions (https://github.com/OpenPanzerProject/TCB/)...   :P

Now I can spend some time studying the code logic and understanding the process flow.

I decided a couple of days ago that I didn't want to relegate my new Panther or Sherman to R&D duties.  Therefore it became necessary to find an adequate test bed.

Lo and behold.  Yesterday, I find new additions to the scratch and dent section (http://www.taigentanks.com/scratch-dent-specials/) for sale on the Taigen Tanks website (http://www.taigentanks.com/)!  A second Huzzah is order!   ;D

(https://farm1.staticflickr.com/481/32155245082_b17dcde932_m.jpg)

My son desperately wanted a Tiger I so this should work out perfectly.  I ordered the IR plastic edition model that was listed thinking it would be perfect for indoor testing.  Eventually I will get the metal wheels and metal tracks to upgrade the vehicle but, for now, the plastic edition should meet my future OP needs.   8)

It will also give me a good chance to brush off my painting skills because he wanted a replica of Tiger 131.  Surely it won't be difficult going from dark grey to desert yellow right?   :-\
Title: Re: Getting Started
Post by: vonTirpitz on January 14, 2017, 04:42:10 PM
Just taking a few moments to step back and take stock of where I am (or think I am) with this project.  This is mostly for me to simply get my thoughts in order since I am barrel rolling into this project and a new hobby at the same time.  If I have glaringly missed something important feel free to chime in!  :)


1 S&D Taigen Tiger I Early Version (Plastic Edition) with IR, 360 Turret Rotation, 3:1 Metal Gearbox, Smoke, Recoil and Lights.
2 Sabertooth Dual 5A 6V-18V Regenerative Motor Driver Serial ESC until the Scout ESC becomes available.

*Still looking for a US Vendor for Benedini products but may just order direct if it comes down to it.  I am still pondering what might be needed for TCB sound development and the Benedini Mini is as good a place to start as any I suppose.
Title: Re: Getting Started
Post by: LukeZ on January 14, 2017, 04:45:26 PM
Don't feel bad vonT, I consider myself in some ways a digital dinosaur as well (I have never owned a smartphone for example). And using HTML in a forum post was only a mistake someone makes who knows too much, not too little. 

You and I have had the exact same idea with regards to testbeds. For the last seven years (http://www.rcuniverse.com/forum/rc-tanks-369/11635636-intro-open-panzer-project-new-tank-control-board-2.html#post12295775) I have been using a PZIII which, while reliable beyond expectation, is really too small. I've since done the same as you, ordered a Taigen Tiger 1 lower chassis to which I will fit plastic wheels and tracks.

If you don't mind sharing I'd be curious to know what sort of embedded work you have done. With any sort of formal education, or even just the long experience you possess, my coding practices may seem unusual - or maybe not, I guess I don't know. I often wonder if I've missed context, perspective or sense of proportion from self-education, but it's hard to know what you missed if you don't what you missed!
Title: Re: Getting Started
Post by: LukeZ on January 14, 2017, 05:00:05 PM
  • Download and compile OPConfig source code to review from GitHub: Still looking around for my old Qt license!
Holy moly, you really are jumping in the deep end!  :o I applaud you sir.

As you mentioned the sound unit, I can volunteer that I purchased my TBS directly from Thomas and at the time I don't think I could have gotten it any cheaper from a US source.

I will also volunteer for what it's worth that my current open source sound card development is using a PJRC Teensy 3.2 (https://www.pjrc.com/store/teensy32.html), Prop shield (https://www.pjrc.com/store/prop_shield.html), SD card shield (https://www.pjrc.com/store/wiz820_sd_adaptor.html), and a simple carrier board (https://oshpark.com/shared_projects/6DH2rzbP). The hardware needs to be simplified but this works for testing.

[EDIT: That is what I'm using for testing now, but please don't follow along yet, or worse, buy any of these components. I have a strong suspicion some of these pieces are going to need to be changed.]

I will attempt to start a thread soon about this project for anyone to follow along with and contribute to. The hardware is basically all off-the-shelf other than the carrier board, which doesn't really do much and could simply be bread-boarded. In the absence of a TCB people could still use a standard Arduino Mega for the purposes of sound card development.

But I am only in the earliest stages now and I need to get some things organized first before posting them...
Title: Re: Getting Started
Post by: vonTirpitz on January 15, 2017, 10:35:12 AM
Whew!  I had forgotten how long it took to install the Qt IDE!  :P.

If you don't mind sharing I'd be curious to know what sort of embedded work you have done. With any sort of formal education, or even just the long experience you possess, my coding practices may seem unusual - or maybe not, I guess I don't know. I often wonder if I've missed context, perspective or sense of proportion from self-education, but it's hard to know what you missed if you don't what you missed!

Well it is a long sordid history I suppose.  ;)  I started out back in the 80's writing code for scientific analysis and some very early robotics.  After college, I moved into aerospace and automotive engine controls focusing on layered communications throughout the 90s.  For the next decade or so I moved around the medical device industry which involved numerous motor and sensor controls.  Currently I am mostly just lifting legacy code (mostly my own) up through the ages trying to keep the energy sector paced with advances in technology.

I wouldn't worry too much about your "coding practices" as that tends to be very objective by whomever is working with it.  Everyone has their own background and experiences through which they see the world.  I figure as long as it is clean and well documented (which yours appears to be) then I would have no worries.   8)

Besides, the project is a work-in-progress and now open source which should bring many positive elements to it.  I am sure that as more folks get involved there will be much to grow upon but I suspect the bulk of your original work will remain the solid platform you developed by yourself.

I salute your perseverance getting it this far.  Personally, I have way too many projects sitting on the shelf that never made it anywhere close to the functionality you have achieved so good job!.   ;)
Title: Re: Getting Started
Post by: LukeZ on January 15, 2017, 12:15:59 PM
Well it sounds like you have a very diverse background and I'm sure we will benefit from any contributions you may decide to make. The beauty of open source is that we can potentially involve a wide variety of skills and by definition, everybody working on the project is interested in and personally motivated.

As for projects on the shelf - believe me I have plenty of those too! But many of them are still there because I have focused on this one.

On the topic of code, there is a brief synopsis of all the custom classes used in the TCB firmware here: TCB Libraries (http://openpanzer.org/wiki/doku.php?id=wiki:devl:libref). At whatever point people start wanting to change things, it is a good place to go to figure out where to look for certain functionalities.

Whew!  I had forgotten how long it took to install the Qt IDE!  :P.
Qt is a bear to get going as I recall, but simple to use once it is setup. This was my first exposure to it and I didn't take advantage of all it could do I'm sure. I hadn't figured anyone would bother to mess with it but seeing you charge ahead I hope we get more like you in time! There is much that could still be done on the Qt side.
Title: Re: Getting Started
Post by: vonTirpitz on January 15, 2017, 05:29:31 PM
You are quite right about Qt.  I'll need a few more quiet hours to get it configured the way I want.  I'll heed your advice and read through the class synopsis.  I primarily just wanted to get all of the IDE's set up and be in a position where I can compile all of the code at any time.  Once that is done then I won't have to worry about it once I get a TCB to play with.  The time between now and then will mostly be reading and learning the codebase.  ;D

I took my son out today and ran the tanks for a few hours.  What's the point of all this if I don't actually run our tanks!  lol.

The one thing that struck me again was just how "coarse" the turret control is on the stock units.  I will definitely want to find improvements with turret and gun elevation control.

I really like both of these tanks but the Sherman 75 has been a real "diva" right out of the box.  If it isn't one thing it is another with this beast.  The Panther has one paint chip.  That's it.  The Sherman, on the other hand, has been a tease.  I swear it has a personality.  Today it developed a strange mechanical "squelch" when turning left.  Checked the gearbox and didn't seem to find anything seized up but will have to go over to RC Universe or email Erik to see if anyone has any ideas about it.

Truth be told, I wouldn't send the tank back or sell it.  For some reason all of the little problems it has so far presented to me have somehow made it more endearing.  Strange.   :-\
Title: Re: Getting Started
Post by: vonTirpitz on January 16, 2017, 07:10:34 PM
Today it developed a strange mechanical "squelch" when turning left.

So I go out to video and record this new "behavior" so I can solicit help and my diva M4A3 decides to make no unusual noises and it performs flawlessly.  I may have to customize it and name it the "Problem Child" (custom decals! whoot!).  Go figure.    ;D

In other news... I finally managed to get Qt configured properly enough to build and run a release version of OP Config!  Hurrah!   :)  <- Edit: Still true but it actually happened a few days after this post.   ::)

A couple of quick reminders for those who follow in my footsteps.


1Not sure how I missed that particular .dll in the build but I am way too tired to look into it tonight.  Ditto for the help files and anything else that didn't quite make it into the build.  The only other thing I noted was that the menu items on the left of the UI weren't highlighting properly so I guess I am not quite ready for prime time.   :P   lol.

Nevertheless, I can now build, deploy and execute both the TCB firmware and the PC configuration software (to a somewhat lesser degree).  I'll consider that a personal victory at this point and can now turn my attention mostly to the code itself.  Aside from fixing some of the Qt config issues I will likely focus on the firmware from this point forward.

Edit: A couple posts further down I have provided step by step instructions to quickly and easily install and configure the Qt IDE for use with this project so most of this post isn't applicable.
Title: Re: Getting Started
Post by: LukeZ on January 16, 2017, 07:57:41 PM
I'd kind of forgotten a lot of this stuff myself and hadn't ever expected anyone to set up a Qt environment, which explains why my installation notes are non-existent. You've gotten 99% of the way there with no help, in just a few days! It took me weeks just to get to where you're at now.


As for the highlighting issue in the sidebar menus - this is a known issue with Qt 5.6. I posted an issue here (https://bugreports.qt.io/browse/QTBUG-53186) almost a year ago but I seriously doubt anyone is going to address it (they are probably waiting for me to solve it). So if you are compiling with 5.6 that may explain what you see. There is a workaround in the source but it's commented out (do a search in the project for "changeStackedWidget56Fix").

The other thing 5.6 does is deprecate elements needed to run the Assistant application. Last time I looked there was no good replacement. Since i kind of liked the help files within the program (even though they are all available online too), I've stayed with Qt 5.4 for now.

I am using Qt Creator 3.6.1 as my IDE and MinGW 4.9.1 as the complier. If you select Qt in your Windows "Add or Remove Programs" (or "Programs and Features" as they call it in new versions), right click and select "Change", the MinGW compiler should be one of the components you can install. But if you are using a different IDE than Creator then this won't be much help.

In Qt Creator you can build your project using different "Kits" and perhaps you are compiling with Visual Studio or something which may explain some of the differences we seem to have. I tried at one time compiling with Microsoft Visual C++ (MSVC) but never got it to work for some reasons I don't recall.

I don't know if any of this is useful or not, just thought I'd throw it all out there.
Title: Re: Getting Started
Post by: vonTirpitz on January 17, 2017, 10:27:41 AM
  I've stayed with Qt 5.4 for now.

I believe you are right so I have decided to roll back to the versions you are using.  I had hoped to stay current with the latest Qt versions just out of my habit of thinking that newer might be better.   ::)
Title: Re: Getting Started
Post by: vonTirpitz on January 19, 2017, 08:34:18 PM
Mostly out of stubbornness, I completely uninstalled my previous Qt IDE attempts and performed a clean installation of the Qt IDE. 

Therefore, I would like to quickly revisit my successful Qt installation for compiling and running the OP Config utility. 

I will simply state that I really, really made the process more difficult than it needed to be the first time by attempting to integrate Qt into my Visual Studio 2015 IDE.   :-\

By rolling back to QT 5.4 (In this case 5.4.2) and using the MinGW compiler and tools for that version, everything progressed quite quickly.  Perhaps someday in the future I will attempt to bring the project build up to the latest Qt version and integrate the Visual Studio IDE.

Anyway, in order to compile and run OP Config (for windows 10 in this case) I performed the following steps:


At this point you should be able to build the project.  On the left side of the IDE screen select the computer icon that is just above the green "run" arrow icon.  From there, select "release" as your build type (the IDE will default to debug otherwise).  You can now select the "hammer" icon at the bottom left to build the project.


Once the build has successfully completed, you will want to copy all of the sub-folders and .dll files from the officially released version of OP Config into the folder where your newly built OPConfig.exe is located. 

(https://c1.staticflickr.com/1/258/32263146812_f74b61b504_z.jpg)

I suspect there are better configuration methods in the IDE to properly create and add these libraries during the build process (without having to manually move them).  However, I am quite satisfied at the moment that anyone can now modify and test changes to the OP Config program. 

Once the build is complete and files copied you should be good to go!  Just select OPConfig.exe and run it.

While I haven't yet messed with the debugger I have been able to build and test all of the functionality in the program short of actually having a TCB to talk to.

By the way, if you receive any compiler errors right off the bat I suggest clearing the system environment (from the project tab on the left side of the creator screen) and running qmake from build menu.  This step really shouldn't be necessary for most of you unless you installed/uninstalled multiple versions of Qt as I had done prior to getting it right. 

Hope this helps and good luck!   8)

-Marc
Title: Re: Getting Started
Post by: LukeZ on January 20, 2017, 10:34:17 AM
It's been over a year since I went through all this myself but I do remember it seemed much harder than it really should be to get Qt working. I think we took a different approach but there are probably a hundred ways to skin this cat. To be honest I found documentation to be one of the weak points of the Qt ecosystem, especially in this topic, and they have download links spread out all over their site for different things, and different ways of actually getting their software, which makes it very confusing.

What I ended up using was their Online Installer (https://www.qt.io/download-open-source/). It may not (probably will not) actually download exactly what you want the first time, but you can always run the tool again afterwards, select "Add or Remove Components" and install the pieces it missed. Most notably I seem to recall the default compiler was MSVC and what I really wanted was the MinGW compiler, but this was easy to add.

In the screenshots below you can see I actually have Qt 5.4 and 5.6 installed, with the MinGW compiler for both (I also still have the MSVC compiler for 5.4 which I don't need). From within Qt Creator (not the same thing as Qt), I can select which Kit to use and I am able to for 5.6 if I want, but due to the above mentioned issues I've kept it at 5.4 for now (5.4 was the latest release back when I started this project).

Anyway thanks Marc for posting a step-by-step guide. If you can think of something that would make it easier for others to get going let me know. Maybe different arrangement of the files on GitHub, I don't know. What's on GitHub does reflect exactly my own project directory.

I kind of try not even to think about Qt installation and had mostly been happy to forget that chapter in my life... ;) I take images of my C: drive at routine intervals precisely so if my computer crashes I don't have to re-install this thing a second time.
Title: Re: Getting Started
Post by: vonTirpitz on February 01, 2017, 09:52:18 PM
Since the desktop software and firmware builds seem to be squared away now I figured it was time to go out and invest in some hardware to play and work with while I wait for the TCB.

All I basically started with were two Taigen tanks and a decent computer and some tools from my workbench.   So after a lot of research and investigation I have received (or am waiting for) the following goodies:


I already own a good Laboratory Bench Power Supply (http://www.mcmelectronics.com/product/TENMA-72-7245-/72-7245) so I am planning to use it in lieu of batteries while testing.  A couple of XT-60 plugs from Aloft Hobbies will let me use the extra two leads I had from my Venom Charger. I know the IBU3 will operates up to 12VDC so I'm planning to emulating my fully charged NiMH at about 8.2VDC.  The TCB should work fine in that range (7-15VDC).

Hopefully I should have everything in hand in the next week or two and can fire up the test Tiger.  I'll try and get some sample recordings from the other speakers and post them in a future installment.

Title: Re: Getting Started
Post by: vonTirpitz on February 10, 2017, 09:38:09 AM
I have started the process of upgrading my test platform (the Tiger I) with an IBU3 so I can play around and experiment with the new hardware as well as familiarizing myself with the QX7 transmitter.

Since the FRS-7 speaker is still out of stock at MCM as well as other vendors I will use a variety of 8W and 20W speakers I picked up to experiment with sound options (Note to self- read the technical descriptions more carefully as the 12W speaker I ordered turned out to only be 8W RMS).  I do not want to use the stock Taigen 3W speaker as I am afraid I would damage it with too much output power. 

One thing I have quickly noticed about this hobby is that I seem to always be short of connectors or wiring harnesses (I had to order a pack of Male JST-XH 1S leads to wire into the speakers). The cost to stock up isn’t too bad but I seem to have a bad habit of overlooking my connection requirements.

So far, I have removed the Taigen motherboard and receiver from my Tiger I as well as the 3W speaker.  My next step will be to wire up the IBU3, a speaker and a FrSky X8R receiver with which to communicate.

I already had the FrSky X4R-SB that I planned to use with the TCB but it didn’t occur to me that the IBU3 doesn’t support SBus until I went to wire it in.  It worked well enough to test the transmitter as well as check out the IBU software but I had to go back and order a X8R so I could get all 8 channels working.  Live and learn…

A few other notable (newbie) learning experiences include discovery that the stock NiMH battery that comes with the QX7 radio has a 2S connector that I did not have an adapter for.  I guess the 9X had a built-in charging port or something but it doesn’t appear to be a feature with the QX7.  Fortunately, the radio accepts standard AA batteries so it wasn’t a show stopper.  (The vendor I purchased from indicated that adapters would be forthcoming after I inquired).

And a 3” speaker sounds small until you get it in your hands and start thinking about where to put it in a 1/16 scale vehicle.  The FRS 7 2.5” is definitely looking to be my go to speaker once they are in stock again.  I still want to try and record some comparative videos with the other speakers to get a better idea about sound quality differences.  If the larger speakers are better quality I might still try to wedge one into that Tiger.   ;)

Despite how novice this might sound I will admit to it anyway as information for any poor soul that is new to the hobby with the tendency to leap before looking.  When I received the FrSky battery with the 2S connector the only thing I had that came close to mating to it was my balance board from the Venom Quad Pro.  The whole thing was confusing the devil out of me so I emailed Venom to find out exactly just how the balance board worked and they politely educated me that it was not capable of charging anything and only acted as a sensor for LiPo batteries.  Makes sense now but for someone with basically no prior experience it needed explanation.

So aside from connecting things up as per the instructions I think I might have an operational Tiger I again this weekend to let me son drive around.  I am sure I will discover and overcome more learning experiences as this progresses.
Title: Re: Getting Started
Post by: vonTirpitz on February 11, 2017, 02:10:16 PM
Well a number of ideas come to mind as I am tinkering with the new gear and radio...

1) We definitely want to consider adding "pictures" to the Troubleshooting section in the wiki when dealing with wiring or other physical issues.  I'm running into a few of problems that are forcing me to scour all over the place to try and resolve.  Is it the receiver? Is it the radio?  Are your controls configured properly? Why does everything shut down when X happens? Why are the signal pins inverted on version X?  Why didn't the answer work?  etc.  Sometimes answers are still elusive even with explanation.  Pictures help tremendously.

2) The term "Plug and Play" is subjective and doesn't necessitate the omission of instructions and diagrams.   PnP compatibility may change over time as products evolve.  ???

3) If the circuit board does not clearly label pin 1 on non-keyed connectors then it might warrant a little more description and imagery in the wiki.  From what I've seen this may not be that big of an issue with the TCB but I'll note it to look at when I get my hands on a production unit.

4) I need to really learn more about programming my radio and what some of the settings might be doing without my current knowledge.  If there are parameters that should be set on a particular radio that would affect TCB functions then we will have to add that to the setup and/or troubleshooting sections.

5) The TCB has many features I am already looking forward to having as I am already identifying shortcomings (in my opinion) in existing commercial products from a novices point of view.   It just occurred to me that I may actually get a production TCB working from Hobby King before I figure out some of the issues I am currently troubleshooting....   :-\

More to follow...


Please ignore most of the above as I was playing around with just random electronics and trying to figure out my own new radio equipment.   Most of the above rambling was a result of frustration not at all related to OP.  My apologies.

Nothing to see here....   :-*

Another realization....  If I had actually listed out eight issues then I would have to again figure out the BBCode so I didn't get a 8).  lol





Title: Re: Getting Started
Post by: LukeZ on February 11, 2017, 09:02:19 PM
I'm concerned this thread is going to end up confusing newcomers here once the TCB is released. It has what appears to be a helpful title ("Getting Started") but then it discusses things which no user will actually need to get started. Compiling code and setting up Qt are topics of interest only to developers and completely unnecessary for any end-user to concern themselves with.

The list of items you just enumerated could also be quite confusing:


Good forum etiquette typically involves creating a "New Topic" that defines a specific topic and sticks to that topic in the discussion. We have to keep in mind these threads are going to stay here for eternity, and be read by many others. My concern is that noobs are going to come in here and see a thread titled "Getting Started" and then get all kinds of turned around or worse, turned off.

The goal of most technical forums is primarily to provide a place to answer (or work through and solve) specific questions and problems, and store that information for others to find later.

At the same time a forum can also be a place for general socializing with others who share our interest, and in that regard threads consisting of non specific chit chat that traverse a wide variety of topics are perfectly fine, but the title needs to make that clear.

So please don't stop what you're doing, I like following your exploration of all things tank related! But I think we should do two things: First, move this thread to the TCB Developer's forum since many of the aspect you delve into are not end-user topics. This I have just done. Second, I would ask that you change the topic title to something better reflecting the discussion here, perhaps along the lines of "Random Experiments" or whatever you like, so long as it doesn't sound attractive or informative to newbies, and makes clear the topic is not about any specific topic. (To change a topic title edit your first post).
Title: Re: Playing around with the software and other random experiments
Post by: vonTirpitz on February 12, 2017, 12:45:17 AM
Agreed.  Sorry for rambling off course.
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on February 14, 2017, 02:49:00 PM
Well I have made some progress with my efforts to get the IBU3 electronics configured and running in my test tank.

I acquired the IBU3 as my way of learning my way around custom hardware and software that already existed for the past few years in the RC tanking hobby.   Since the production OP TCB isn’t yet available through Hobby King it seemed like a logical path to follow in aiding my effort to learn and comprehend not only fundamental RC concepts, but also gain valuable experience in the custom electronics arena.  While I could build a TCB from the information provided on this website I am going to go with "I am too lazy and lack the patience to do that" and wait for Hobby King to release it...

So, as a precursor to the Open Panzer TCB, I feel that this path would also give me some advantage when it comes to comparing the existing features and capabilities of the Taigen OEM motherboard and IBU3 with the upcoming release of the OP TCB.  As I learn about what is already out there I think I can better understand and appreciate what the Open Panzer project truly brings to the table.  The whole process has given me several ideas and I am looking forward to using the TCB once it comes out.   (One thing I want to definitely look at in the TCB code is when it is controlling the servos how it keep tracks of the pulse count(s).   I believe that the idea is already been touched upon from what I've read about maintaining barrel elevation and having the turret traverse back or stay at a known location but I need to dig into it to see how exactly it works).

==== Self Reminder: Meet the Power Requirements

Anyway, I found myself with a few issues working with the IBU3 initially.  First and foremost, I realized last night that I had set the current limit on my benchtop power supply too low.  With the V2 Taigen smoke unit connected and everything running at maximum settings I needed more than the 2 amp limit I had initially set.  Ultimately, I just set my power supply to provide maximum amperes (~3A) on that channel and so many of the little mysteries vanished and it seems to max out at around 2.8A.    Leave it to a software guy to overlook the power requirements....   :-[

On the flip side, knowing that my Tiger can gobble up upwards of 3A running all out also means I can more accurately calculate how long my batteries would hold up under such conditions.  It also has me thinking about the possibility of wiring up my batteries in parallel to get more run time (alas, this is would be another mini project for a future time).

With regard to wiring, I also need to remember to solder that single ground wire coming out of the IR module in the turret to the switch ground.  I was going to just use a common ground on the IBU module but was told that could have negative repercussions on the electronics should a malfunction occur.  No problem.  Just a little more soldering on my part.

And I want some better cooling fans.   I am not yet running into any thermal issues but I like the idea of keeping electronics as cool as possible and the little PC fans I currently have just aren't moving that much air.  I'll go out to my usual online store haunts and see what is out there....

==== Self Reminder: 2.4GHz can potentially be a noisy environment

An issue I was dealing with in conjunction with my self inflicted power mix up is that I am losing radio contact with the receiver and sometimes get unusual responses from the tank.  The low current may have factored into some of this early on but now that the power issue has been alleviated I am still seeing some problems maintaining radio contact with the X8R receiver.  The fact that I am only a foot away would tend to eliminate distance as a factor.

I first replaced the already installed PCB trace antenna with the “whip” antenna that were also included thinking that might be a factor for some reason.  This change seemed to help somewhat even though I would not think directional aspects would apply.  Maybe someone out there can tell me if the PCB antenna work better in tanks than the whips.  I guess I need to add antennas to my list of reading materials...   :P

As I continued to pursue this issue a thought occurred to me while I was working with the hardware last night...

My work area is particularly compact and I tend to lay my radio down in front of me in such a way as to where its antenna extends out over my computer keyboard.  The computer workstation is also nearby and I am pretty sure it is just radiating EMI and causing potential radio interference.
 
I suspect that my computer and/or keyboard are to blame as the interference “appears” to go away when I pick up the radio and move it away from these potential sources (I need to figure out a way of getting my hands on a spectrum analyzer one of these days).

Once I clear up the radio interference to my satisfaction I am just about done with this part of my experimentation.  I will likely play around with some of the IBU features such as acceleration mapping as well as using it to test and compare the various speakers I have for audio quality purposes.  In retrospect, I am not really certain I can distinguish and present speaker quality from recordings I've made.  The nuances between speakers that I can hear don't really get picked up by the recording hardware I have and I am sure the recording software I use is likely filtering as well.  More conundrums...   :o

==== Self Reminder: Learning what my radio can do

My next big target of exploration is going to be the Taranis Q X7 and OpenTX (http://www.open-tx.org) to get a better handle on the programmable features and capabilities it provides.  I have already been told that some folks have been able to program their Turnigy radios and move the IBU3 gun firing from the joystick to discrete switches on their transmitters.   Surely there is a way I can figure out how to do this on the Taranis I have.  Just a little more reading....   8)

The documents section of the OpenTX website presents an enormous amount of reading material.  So, in addition to the task of reading and understanding the information provided in the Open Panzer wiki (http://openpanzer.org/wiki/doku.php) , I can also add all this OpenTX and Taranis material to my plate of reading material.  I know that all of this really isn’t a requirement (or necessary) to have fun and use the TCB in my tanks but I would like to know more about my radio and what kind of performance I can squeeze out of it.

In summary, I have to give a nod of credit to forum members and cottage industry owners across the RC and modeling communities as everyone I has been helpful and willing to answer questions (Of which I still have plenty).   And, for me, the Open Panzer project was exactly what I needed to get into this.  ;D
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on February 14, 2017, 04:40:31 PM
=== Current Draw Reference (IBU3 Controller, 8W 3" Speaker, FrSky X8R, Taigen V2 Smoker configuration @9VDC):

Powered ON (no USB connection): 0.26A
Powered ON (USB connection): ~0.27A

Powered ON (USB: Engine Startup and Audio 50% volume): ~0.33A
Powered ON (USB: Full Throttle and Audio @50% volume): ~1.7A
Powered ON (USB: ZeroThrottle and Audio @50% volume: Proportional Smoker): ~0.67A
Powered ON (USB: Full Throttle and Audio @50% volume: Proportional Smoker): ~2.6A

Powered ON (USB: ZeroThrottle and Audio @50% volume: Relay Smoker): ~1.85A
Powered ON (USB: Full Throttle and Audio @50% volume: Relay Smoker): ~2.6A

====

I wonder if the Smoker pulls more current if it runs low on oil?  If so, that would be something to look into as a way to automate smoker shutoff if someone hasn't thought of it already.

And, yes, I just tested out my theory from the previous post.  Apparently my keyboard does interfere with the 2.4GHz transmitter when the antenna is within 4-6 inches of it.  Who would've guessed???   Now I wonder if I was premature in replacing the PCB antenna on the receiver.  :P
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on February 18, 2017, 04:47:49 PM
Today, with a little trial and error, I was able to get the functionality I was looking for between the Taranis Q X7 and the IBU3.  Aside from the normal functions I wanted to remove the gun firing trigger from the elevation joystick and assign each gun firing to a discrete switch.

Using the OpenTX functionality I reduced the Weighted value of the gun barrel elevation channel (In my case Channel 1) to 80 to prevent the joystick from reaching the trigger value and causing the guns to fire for both the main gun and machine guns (which would normally fire with the joystick fully engaged up or down).

I then used the Special Functions to enable the switch SC↑ to override CH1 with a Weighted parameter of 100 and likewise switch SC↓ to override CH1 with a Weighted parameter of -100 which effectively fire the main gun and machine guns respectively depending on whether the SC switch was moved forward or back.  I suspect that there are many other ways of customizing this given the spectacular flexibility of OpenTX but I am satisfied with my results

IMPORTANT! Make sure to make plenty of backups!  I had to use my original backup a few times to “unbreak” things I muddled with unsuccessfully.   :P  \

At one point I somehow managed to reset the radio so it was giving a low battery alarm at less than 9v.  Finally figured out to get to the radio settings by pressing the Enter and Menu buttons on the Q X7 at the same time (Surprised I haven't found that menu in the OpenTX Companion yet).  Oh well.  I still look at it all as small personal victory.  lol.
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on February 23, 2017, 08:05:46 PM
Marc, just wanted to let you know I've updated the TCB project to work with the new process the Arduino IDE uses for custom boards.

Previously one needed to edit Arduino's boards.txt file and this is what the instructions on the TCB GitHub page said at the time you got set up.

The new method involves giving the Arduino IDE a link and then letting it install the board using Tools->Board->Boards Manager. There are updated instructions (with photos!) in the TCB GitHub repository readme (https://github.com/OpenPanzerProject/TCB).

You can delete the old entry in your boards.txt file if you want.

New developers hopefully will read the new instructions and be set from the get-go. The new system was a lot of work to set up, but it's easier for the end-user (coders in this case), and also gives us better control of how the code is compiled, and makes maintaining future changes, or even adding new boards later, much easier.
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on February 24, 2017, 08:36:07 PM
Marc, just wanted to let you know I've updated the TCB project to work with the new process the Arduino IDE uses for custom boards.

Previously one needed to edit Arduino's boards.txt file and this is what the instructions on the TCB GitHub page said at the time you got set up.

The new method involves giving the Arduino IDE a link and then letting it install the board using Tools->Board->Boards Manager. There are updated instructions (with photos!) in the TCB GitHub repository readme (https://github.com/OpenPanzerProject/TCB).

You can delete the old entry in your boards.txt file if you want.

New developers hopefully will read the new instructions and be set from the get-go. The new system was a lot of work to set up, but it's easier for the end-user (coders in this case), and also gives us better control of how the code is compiled, and makes maintaining future changes, or even adding new boards later, much easier.

That's great news.  Thanks!  I'm playing with the code this weekend and looking into some emulation options I can test without the hardware.  I'll post if I make any useful progress.

Marc
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on February 28, 2017, 03:26:39 PM
Marc, more updates. I've decided to move all libraries into a src/ subfolder of the sketch folder, rather than having them jumbled in with the user's general Arduino library folder. This means the entire project can reside in a single folder which will make it much easier to manage for people wishing to contribute via GitHub.

I have also released a new version of the custom boards that you should install in Boards Manager. I am new to boards manager and have been learning more about it, so the original needed to be replaced. You should just be able to do this by going to Tools->Board->Boards Manager, selecting the Open Panzer board and clicking Install or Update, but if it gives you problems you might need to delete any Open Panzer packages from:
C:\Users\your_name\AppData\Local\Arduino15\staging\packages\

Sorry for the hassle. Up to very recently this project has been set up in a way that was convenient for me to develop, without much thought to future contributors. So I'm afraid you're a victim of early adoption. I think these various changes will make life much easier for developers going forward.
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on March 02, 2017, 05:10:06 PM
Marc, more updates. I've decided to move all libraries into a src/ subfolder of the sketch folder, rather than having them jumbled in with the user's general Arduino library folder. This means the entire project can reside in a single folder which will make it much easier to manage for people wishing to contribute via GitHub.

I have also released a new version of the custom boards that you should install in Boards Manager. I am new to boards manager and have been learning more about it, so the original needed to be replaced. You should just be able to do this by going to Tools->Board->Boards Manager, selecting the Open Panzer board and clicking Install or Update, but if it gives you problems you might need to delete any Open Panzer packages from:
C:\Users\your_name\AppData\Local\Arduino15\staging\packages\

Sorry for the hassle. Up to very recently this project has been set up in a way that was convenient for me to develop, without much thought to future contributors. So I'm afraid you're a victim of early adoption. I think these various changes will make life much easier for developers going forward.

No hassle.  Any improvements are well worth the experimentation.   ;D
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz on March 25, 2017, 10:07:36 AM
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
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on March 25, 2017, 05:09:18 PM
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.
Title: Re: Setting up a software development environment and other random experiments
Post by: vonTirpitz 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!

(https://farm5.staticflickr.com/4547/38495391716_1602702a8b_m.jpg)
 (https://www.flickr.com/photos/28801742@N04/shares/486W0x)


Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ 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.
Title: Re: Setting up a software development environment and other random experiments
Post by: Heclo 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
Title: Re: Setting up a software development environment and other random experiments
Post by: Heclo on October 07, 2020, 02:15:13 AM
Attached the wrong picture to the post above..

Here is OP_Driver.h
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ 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.
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ 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.



Title: Re: Setting up a software development environment and other random experiments
Post by: Heclo 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
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ 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...
Title: Re: Setting up a software development environment and other random experiments
Post by: NS-21 on June 27, 2021, 03:23:59 PM
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! (https://doc.qt.io/qt-6/whatsnew60.html#removed-modules-in-qt-6-0)

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 :

Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on June 29, 2021, 10:18:51 PM
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 (https://github.com/OpenPanzerProject/OP-Config/commits/master).

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 (https://www.sourcetreeapp.com/) to manage uploading the files from my computer to my GitHub account and that makes things a bit easier.
Title: Re: Setting up a software development environment and other random experiments
Post by: NS-21 on June 30, 2021, 08:25:38 AM
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.

Title: Re: Setting up a software development environment and other random experiments
Post by: NS-21 on July 01, 2021, 02:37:42 PM
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.

(https://live.staticflickr.com/65535/51283560276_3496fa3841_h.jpg)
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on July 01, 2021, 11:07:23 PM
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. 
Title: Re: Setting up a software development environment and other random experiments
Post by: NS-21 on July 02, 2021, 12:24:27 AM
I don't have very much time right now but I will write you a better response this weekend.

LukeZ! You drive me into paint and I am terribly ashamed!

I am patiently waiting, I have known for a long time that you have a lot of work, it can be seen with the naked eye.
(if a person appears on the forum and spends enough time just to read - I know from my own experience that he is heavily loaded with work).
I also know that we have different time zones.
I still have something to do, waiting for an answer. I also translate the wiki.



Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on July 03, 2021, 10:18:04 PM
LukeZ! You drive me into paint and I am terribly ashamed!
Please don't be! :D I am happy to help, only sometimes I am slower than others!


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.
Most likely your settings in mainwindow.ui are getting over-written by the code because I set these shortcuts in the actual code. See the function "MainWindow::initActionsConnections()" in the file "mainwindow.cpp"
For example, you will want to change:
Code: [Select]
ui->actionOpenFile->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));to
Code: [Select]
ui->actionOpenFile->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));


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 ^ _ ^
Well you can't break anything on the Open Panzer GitHub so feel free to look at it as much as you want. But you will probably want to create your own GitHub repository and it will certainly be possible to break your own! But you have a backup on your computer until you figure out how it all works.


Ok! I will write another post shortly with information about InnoSetup.
Title: Re: Setting up a software development environment and other random experiments
Post by: LukeZ on July 03, 2021, 11:03:36 PM
Here is some information on creating an installation package.

First, you will need the InnoSetup program (https://jrsoftware.org/isinfo.php). I am using version 6.0.2 and they have a more recent version now, but I assume it will still work.

Then download this Zip file. It is too big to attach to this post so you will have to right-click on this link and select "Save link as" to save it to your computer:
OPConfig_InstallPackage.zip (http://openpanzer.org/downloads/opconfig/innosetup/OPConfig_InstallPackage.zip)

When you unzip the file you will see has two subfolders and an ".iss" file:
I know the information I have given you so far has not been very detailed and there are a lot of things you have had to learn on your own. So don't hesitate to let me know if you have more questions.

When I was teaching myself all this Qt stuff it was like learning a foreign language. But you are learning this foreign language in a foreign language! Honestly I am amazed at how far you have come.