Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LukeZ

Pages: 1 2 [3] 4 5 6 ... 78
31
TCB Dev / Re: Ideas for the OP Config
« on: May 25, 2023, 10:07:35 AM »
Hi Rongyos, thanks once again for doing this test. I apologize I'm not able to work out these bugs on my end, I only have a couple TCB boards left to me and they are in a storage box on the other side of the world!

I think I know what was wrong with the brake light effect. I've made a new firmware, this time I'm just attaching it to this message and will wait to update the official one until we have all the problems worked out. Can you test once again with the brakelight and let me know how it looks?

As for the headlight pin, no, unfortunately, that is what I was saying earlier, it is not PWM compatible. It can only be turned on or off, and I agree with you, that effect does not look very good...

It should be possible to flicker the Aux output but let's see if the effect looks good on the brake output first, because it will be the same effect on the Aux output.


32
TCB Dev / Re: Ideas for the OP Config
« on: May 23, 2023, 08:06:48 AM »
Hi Rongyos, you're right, simply turning a light on and off doesn't make for a very realistic "flickering" effect. I haven't actually seen what it looks like, but I can imagine it is not very good.

Unfortunately, that is the only option we have for the headlights, which is connected to a "digital" output on the ATmega2560 chip. A "digital" output is one that can only have two states, either on or off. There are other pins on the ATmega2560 that are called "analog" outputs and those can be set to any level between off (0) and on (255). But these pins are limited in number and we have had to use them for other things.

The brake light is connected to an analog output which is how we are able to dim it for "running lights." If you set the "Brake Lights on When Stopped" option you will see that it uses a flickering effect similar to the candle effect you found. But when we are flickering the "running lights" I can't be sure what dim level the user specified, and to flicker a dim light it might not be very visible, so in that case I am flickering it only between off and the dim level.

Here is the code I have added which handles the flickering. There is more than this, but this is the important part:

Code: [Select]
// This effect takes place on engine startup if the user has selected the option to "Flicker Headlights on Engine Start" (Lights & IO tab of OP Config)
// and if they have specified a "Transmission Engage Delay" (Driving tab of OP Config). The effect will last for the duration of the Transmission Engage Delay.
// It applies to both the headlights and the brake/running lights, but only if they were already on before the effect begins.
void FlickerLights()
{
    static boolean flickerState;
   
    // Initialize if appropriate:
    if (HeadlightsFlickering == false && BrakeLightsFlickering == false)  // They will both be false if we have not started the effect.
    {                                                                     // They will both remain false if neither the headlights or brakelights are on, in which case we won't come back here.
        // Only flicker lights that are already on
        if (Light1State)                                    HeadlightsFlickering = true;
        if (BrakeLightsActive || RunningLightsActive)       BrakeLightsFlickering = true;
        if (HeadlightsFlickering || BrakeLightsFlickering)  flickerState = false;  // Initialize light state to false (which has the effect of starting the effect with "on")
    }

    // Now perfrom the flickering if it has been enabled
    if (HeadlightsFlickering || BrakeLightsFlickering)
    {
        if (HeadlightsFlickering)
        {
            // The headlight output can not be dimmed, so we simply toggle it on and off.
            // We don't use the dedicated Light1Toggle function because that would also call the headlight sound, which we don't want, not to mention the possible debug message.
            flickerState ? digitalWrite(pin_Light1, LOW) : digitalWrite(pin_Light1, HIGH);         
        }
       
        if (BrakeLightsFlickering)
        {
            // The brake light flickering effect will differ depending on whether we are flickering the running lights or the full brake lights.
            if (BrakeLightsActive)
            {
                // Here we vary the light between some lower and higher dim levels, it can go full off or full on, but also something in-between
                if (flickerState) analogWrite(pin_Brakelights, random(100));      // Dimmer   - random value between 0 (off) and 100 (not even half brightness)
                else              analogWrite(pin_Brakelights, random(75)+180);   // Brighter - random value between 180 and 255 (full on)
            }
            else if (RunningLightsActive)
            {
                // Here we vary the light between full off and whatever the running lights dim level is
                flickerState ? digitalWrite(pin_Brakelights, LOW) : analogWrite(pin_Brakelights, RunningLightsDimLevel);
            }
        }
       
        // Toggle the flicker state, now it will match what we've just done above (which was the opposite of flickerState)
        flickerState = !flickerState;
       
        // Now set a timer to come back here after a random amount of time to continue the effect
        // We adjust the random delay so that the light "off" time is shorter than the light "on" time
        if (flickerState) FlickeringTimerID = timer.setTimeout(random(350)+60, FlickerLights); // On  - random time between 60 and 410 mS
        else              FlickeringTimerID = timer.setTimeout(random(210)+50, FlickerLights); // Off - random time between 50 and 260 mS
    }
}

I think the only other option to improve the headlight flickering would be to use the Aux output for headlights instead. The Aux output uses an analog output and therefore could be flickered more realistically. Of course this would require even more changes, and also there is no headlight sound associated with the Aux output (although one could be created with Function Triggers assigned to the same switch).

I'm not sure if the added complexity would be worth it... I may consider it but I need to explore the code some more to remind myself what complications that would involve.

In the meantime, maybe you could attach a white led to the Brake lights, and select the "Brake Lights on When Stopped" option, and then at least let me know if that effect even looks very good?

33
TCB Dev / Re: Ideas for the OP Config
« on: May 22, 2023, 03:30:06 PM »
Hi Rongyos, thank you very much for doing that test. In fact I see now there were multiple problems with the code I had written. It's always more complicated than it seems, and you're absolutely right, there are more dependencies than even I can remember!  ;)

But your test helped me find the problems. Also, in the version I posted yesterday, I hadn't implemented flickering for running lights, only brake lights. But I've added it now for both. And of course we don't want the headlight sound to be playing while we flicker the lights, so I've fixed that as well. Your 2 and 3 position switches should also hopefully now work correctly.

I've posted an update to the firmware. I am keeping the same version name, but you can still download it and overwrite what you flashed yesterday.

It's entirely possible there could still remain some bugs. I apologize I can't presently do any testing on my side, and I appreciate you being the guinea pig!

Let me know how it goes.

34
TCB Dev / Re: Ideas for the OP Config
« on: May 21, 2023, 02:54:04 PM »
Hi Rongyos, thanks for the question, and don't worry, your English is very good. I understand clearly what you are asking.

I've made some updates to the firmware to incorporate your suggestion. You will have to update both OP Config and also re-flash the latest firmware to your TCB (the latest version of both is 0.93.75)

To enable this feature there is an option on the "Lights & IO" tab of OP Config that you can select, called "Flicker Headlights during Engine Start."

The length of time that the flickering effect will last is defined by the "Transmission Engage Delay" setting on the "Driving" tab of OP Config. Since this setting should be set to the length of time of your engine start sound, it will also work for the flickering.

The flickering will affect both the headlights and the brake lights, but only if you have them on before you start the engine. In the case of brake lights, probably the only way for them to be on before the engine is started is to select the "Brake Lights On when Stopped" option on the Lights & IO tab.

The headlight output on the TCB is unable to be dimmed, it can only be full on or full off. However the brake lights output can be set to any intensity. I've used a slightly different approach on each one, the brake light will flicker in sync with the headlights but because it is able to be dimmed I've used that to make the flickering a little less harsh.

I don't actually have a TCB to do any tests with, so I can't say exactly how good it will look. I'd appreciate if you could test it both to make sure it works as intended and also to let me know what you think of the flickering.

35
Open Panzer Help / Re: CS-TK-SWB Heng Long
« on: March 07, 2023, 01:22:06 PM »
Hi Paul, that is an interesting device which I did not know about, even though it seems it has been released for several years.

As usual the Chinese documentation leaves something to be desired, but from what I can tell this is a standalone gyro system that operates with standard RC inputs. In that case it should work with the TCB or any other control board that can output servo signals.

These are the connections you would make with the TCB:

Heng Long TK-SWBOpen Panzer TCB
P2-1RC Output 3 (Turret rotation)
P2-4RC Output 4 (Barrel elevation)

In OP Config on the Motors tab, you will want to set both "Turret Rotation" and "Barrel Elevation" to "RC Output."

Then connect a rotation motor and an elevation servo to the TK-SWB, and of course you will have to provide power to that unit also, as shown in the Heng Long diagram.

I can't promise this will work but I think it should. I'd be interested to hear the results of anyone who gives it a try.


36
Show and Tell / Re: High speed tracked vehicle....something different
« on: February 12, 2023, 11:24:43 AM »
Hi Graham,

I can well imagine your frustration and my apologies! When I was creating the Downloads page and other sections of the site I wasn't really thinking of people building their own, but now that is the only option you are right this information should be more prominently displayed. I've added a couple links to the TCB Hardware section that will hopefully help others avoid this kind of head scratching.

Thank you for the recommendation and I wish you success with your boards! If any other questions arise please don't hesitate to ask.

For anyone else at this stage, here is one of the links I posted, which explains the one-time bootloader process on blank chips:

Flashing Bootloader to Blank ATmega2560

37
News & Announcements / Re: It's all over?
« on: February 05, 2023, 01:41:49 PM »
Hi Jürgen! I hope you are doing well in Germany.

Well anyway I am still here lurking. Maybe the board has become so perfect there can be no more questions? ;) No, I don't think that's it.  ;D

But since no one can buy one for many years, and it is very difficult to build (maybe impossible now with the chip situation) I am not surprised it is quiet here.

38
Thanks Rongyos, it sounds really good! I posted them to the GitHub where anyone can download them.

39
Open Panzer Help / Re: Heng Long 7.0+ compatability
« on: December 02, 2022, 07:41:38 AM »
Hi Mitch, I have not tested the Heng Long 7+ boards, but it is my understanding all HL boards from 6 and later use the Tamiya IR protocol, so yes it should be compatible with the TCB and with any other board that uses Tamiya, which today is basically all of them.

The Heng Long IR receiver you linked to should work with the TCB, again I have not tested it but all these receivers are generally about the same thing.

However you will need to make sure that you connect the pins in the correct order. On the TCB the Apple connector is 5 pins but the Heng Long receiver is only 3 pins because it does not have a notification LED built in. If you look on the bottom of the TCB board you will see the three pins that you need for the receiver. The pin order is not the same as the Heng Long plug, which uses + - S (connection CN16 on the TK7), but on the TCB the order is + S -.

So you will have to re-arrange the connections, but otherwise I'm guessing it will work.

40
Open Source Sound Dev / Re: The cheapest sound is for OPEN PANZER
« on: November 06, 2022, 07:54:47 AM »
Hi Phantom, welcome to the forum. Unfortunately the MP3 player you describe is not compatible with the Open Panzer TCB.

The guys on the Russian forum built their own control board which uses that MP3 player. Their project is not the same as the Open Panzer project, and their code is not the same as ours. In other words, if you want to use that MP3 player you will have to use the Russian control board, and will need to contact them about it.

The only sound cards that are compatible with the TCB are the Benedini (Mini and Micro), the Taigen sound cards, and the Open Panzer Sound Card.

41
That is a clever solution! I'm glad you succeeded, even if you had to do something unorthodox.  ;)

42
Hi Rongyos. I looked at your snoop file. You're right, it is definitely something that is happening at the very beginning, when the TCB first makes a connection with the receiver. There are several functions it runs right away (MG Stop, turn the light off, set the volume) and these are what we would expect to see as it starts reading the channel values and applying the functions that you have set for your switches based on the position they are in (it is easy to see that you have your MG and light switches in the middle position). So everything is working as we would expect, but it also fires the cannon which means that it believes your cannon switch is in position 2.

I know you believe the cannon switch is in position 1. You can try this experiment: instead of starting the TCB with the cannon switch in the "off" position, put it in the "on" position and start the TCB. If the cannon doesn't fire, then it was just a confusion that can be fixed by reversing the channel.

If it fires no matter what, then it might be as you say some kind of failsafe setting. Maybe the TCB boots up faster than your receiver can create a connection to the transmitter. If that is the case, the first signals the TCB reads from the receiver are actually failsafe positions rather than the actual positions of the switches on your transmitter.

You could see what happens if you press the "Reset" button on the TCB. This will cause the TCB to reboot, but it will not interrupt power to the receiver. So your receiver will already be connected to the transmitter when the TCB starts. Does the cannon behave correctly then?

What software are you running on your TX16? If it is OpenTx, here is a video on how to set the failsafe values. I don't know if that is your problem or not, but you could experiment with it anyway. You will want to set the failsafe position of Aux Channel 6 to position 1, so that if the connection between the receiver and transmitter is lost, or hasn't been established yet, the cannon will not fire.

43
Hi Rongyos, if I understand you correctly, the cannon fire happens when the TCB first starts. And this involves not only the sound, but also the recoil servo. If that is the case, then we can eliminate the sound card as being related to your problem, it is clear that the TCB is the one firing the cannon.

Plug your TCB in to your computer with a USB cable and connect to it with Snoop (on the Firmware tab of OP Config) to see what is happening. Does the TCB report a "Cannon Fire" event when it first starts?

I wonder if maybe you have Aux Channel 6 in Position 2 when the TCB starts?

I see you have Aux Channel 6 set to "Reversed" in OP Config. Maybe un-reverse it in OP Config, and reverse it in your radio's settings. You can also try changing the cannon fire function to a different aux channel.

I can't say what the problem is, but I am confident it is not an error in the code. Somehow the TCB thinks that the cannon should be fired, which implies that your radio is telling it to. You will have to do some more troubleshooting yourself. Even if you don't solve the problem right away, hopefully you can discover a piece of information that will help us solve the problem.

44
Hi Rongyos, that is a strange problem. What I can say is that the sound card will only play the sound that it is being commanded to play. So there are two basic possibilities:
1. You have a sound file on your SD card that plays the cannon sound, but you gave it the file name for something else (in other words, something other than "cannonf.wav")
2. Or for some reason the TCB is sending the signal to fire the cannon at the same time it sends the signal to start the engine.

For #1, I would put the SD card into your computer and listen to all your sound files once again, just to verify that the cannon sound didn't somehow get named to something else.

For #2, examine all your function triggers in OP Config. Did you maybe link the "Cannon Fire" function to the "Engine Start" trigger by mistake? Did you maybe assign the "Cannon Fire" function to the same switch on your transmitter you are using to start the engine?

You can post your OPZ file if you want me to look at it.

There is something else I noticed in your video, which may or may not be related to your problem. I notice there is a delay of several seconds from the time you flip the switch on your transmitter, to the time when the engine starts. Do you know why that is?

By any chance do you have an engine "Preheat time" specified? (In OP Config on the Motors tab, under the Smoker section, when Type is set to "Separate Heat & Fan").

On your SD card do you have a sound file called "preheat.wav"?

If so, you may want to do a test where you delete "preheat.wav" or set "Preheat time" to 0, and see if that makes any difference.

45
Hi Rongyos, your connections are correct!

It is easy to get confused with the labels, but another way to be sure is simply to connect ground (GND) to ground, the middle connector from one is connected to the middle connector of the other, and that only leaves one connector on each board which by default will be connected to each other. This is true for the TCB, the sound card, and the Scout ESC.


Pages: 1 2 [3] 4 5 6 ... 78
bomber-explosion