Pages: 1 ... 4 5 6 [7] 8 9 10
61
« Last post by LukeZ on January 09, 2024, 03:46:00 PM »
Hi Chris, no, I don't think there's anything you've missed. You have interpreted the schematic correctly as far as what pins go to what. The good news is that if PPM is working that tells us at least that the TCB code is functioning and that your receiver is not completely a duff either. The FS-A8S was my favorite receiver of the FlySky ecosystem, so I know it can work with the TCB. But it could be that they have updated the firmware on the transmitter with extra settings that I don't know about or remember. If (in the transmitter) you set Serial to iBus that should work, but I don't know, maybe you need to re-bind after a change, or maybe for some odd reason it wants the other setting to be PWM. I'm just making random guesses, I really don't remember what the transmitter settings were. As for the TCB, yes, it starts off looking for sBus, then iBus, then PPM, but if it fails all three then it starts over again and repeats them all in a loop over and over, so if the iBus signal is there, it will pick it up eventually. I'm willing to bet the answer will end up being something simple. You could certainly put some diagnostic statements in the TCB code, maybe something that would be even easier and quicker is to download the IBusBM library. It includes a sample sketch called Ibus_singlemonitor that you can load on to your Mega, connect your receiver as described in the notes at the top of the sketch, and it should spit out the channel values on the Serial Monitor. There is some stuff in there about sensors which you won't need. Anyway at the least it would serve as a sanity check.
62
« Last post by FuzzyJack on January 09, 2024, 03:01:11 PM »
I have been trying to get OP-Config working with an Arduino Mega standard board (well I say standard it’s an “Elegoo” model rather than Arduino) and it fails to read the radio when trying to use I-bus.
I’m using a FlySky i6s with a FS-A8S as per the recommendations on the wiki. I have the output mode set to PPM and Ibus for serial. I connect the ibus cable to pin 15 as per the guide for Arduino but op-config fails to find the radio.
If I connect the ppm cable to pin 3 it finds it ok and can read the data ok. Ppm of course only gets the 8 channels and I was hoping to use ibus to make use of the extra couple of switches.
Before I go trying to diagnose if pin 15 is even getting a signal or if the receiver/transmitter are even talking ibus is there anything I am missing or any known issues/workarounds?
Pretty sure the code on the TCB project is set to subs initially by default and the tries ppm and ibus. Not sure which it tries next but it either isn’t getting ibus or not seeing it on pin 15.
Might have to go and put some diagnostics in the radio class to see if it’s even trying or if the receiver is duff.
63
« Last post by LukeZ on January 09, 2024, 02:44:11 PM »
Hi Rongyos, At this point there are so many different symptoms which don't seem to have any relation to each other, that it is hard to say what is going on. If the board board is reseting/freezing/locking, or just in general acting bizarre (not completing the serial statements, erratic servo behavior, etc...) something is not right, but yet I experience none of these on my end. So there are two possible explanations: 1. Possibly we are still struggling with a compiler issue. I kind of doubt it, but if you want to replicate my setup I am using Arduino IDE version 1.8.13 with the AVR Boards set to 1.6.20. We already discussed changing the boards to 1.6.20, but maybe there is a difference with the compiler itself. You could try downloading and installing 1.8.13 from this link, and again make sure the AVR Boards is set to 1.6.20, and see if that improves anything. 2. The second option, is that you are using modifications to the code that are causing problems, or there are electrical issue with your custom board. Those are things only you can troubleshoot, but through a process of elimination it is still possible to reduce the number of possibilities until you find the culprit. I think you should try the sketch in its stock form, unmodified, on your Nano without your carrier board, powered by USB. You can attach the LEDs and servo directly to the Nano using jumper cables. It would even be wise to remove the Heng Long or whatever MFU you are using, and instead trigger with a button or just by holding a wire from D4 to ground. I have even attached a Hex file below that I have compiled on my computer, and it works flawlessly here, at least for firing the cannon (I have no means of testing IR reception right now). All settings in this compiled Hex are at default, meaning the 5v input is disabled. I can fire the cannon time and time again and the servo always responds correctly, the IR is always sent, the reload notification LED always blinks, and all the serial statements are complete and accurate. It is true that when the Arduino first boots up, the servo may move a little bit. This is normal and unavoidable. But once running, the servo shouldn't do anything unless you fire the cannon. Honestly, when I watch your video, I don't really see anything out of the ordinary. Maybe the relays are acting strange, but the relays are not part of my sketch, so I don't know anything about that. I don't see the reload notification LED blinking, so either that is not enabled in Setup, or else it is not connected to the Arduino, I don't know. But when you fire the cannon, I do see the recoil servo working, and the IR LED transmitting. In summary, the only way to solve any technical problem of this kind is to simplify everything down the absolute minimum until you arrive at a state where things work as they should. Only then can you begin to make changes, one at a time, testing at each step, until a problem occurs. Then you know what the problem is.
64
« Last post by Rongyos on January 09, 2024, 01:47:23 AM »
The GitHub is now updated with all these changes. I hope now everything will work, please let me know your results.
Hi Luke! Thank you again for you quick support. Unfortunatelly those mods are not working. The notify led is acting strange, when I shot the cannon some time (usually 4-5 times) the arduino reset itself and stay in a strange state ("L" board led is on, relay is on). You can see the pic what I mean. When I plug in the USB to see on the serial monitor what happens, this issue is not appearing (can it be a power supply issue? If yes, why servo, recoil and hit notification working?) MOD: well, in the pic the notification led is not on (3mm red one). But most of the time it freezed at staying on When I only tried the 5V trigger mod of yours there wasn't any different operation then before. Phantom firing is still there. BUT I realized 2 things, maybe connected. 1. when I power on the arduino, there is ~20degree turn in the servo, like it start firing then stops. But, it does a firecannon function and everything works fine after that. 08:17:47.916 -> --------------------------------------------- 08:17:47.916 -> BATTLE INFO 08:17:47.916 -> --------------------------------------------- 08:17:47.916 -> Is Repair Tank? No 08:17:47.916 -> Fire Protocol: Tamiya 08:17:47.916 -> Hit Protocol 2: Heng Long 08:17:47.916 -> Repaired by: Clark Repair 08:17:47.916 -> Send MG IR Code: No 08:17:47.916 -> Accept MG Damage: No 08:17:47.916 -> Damage Profile: Tamiya Spec 08:17:47.916 -> Weight Class: Medium 08:17:47.916 -> (6 cannon hits, 5.0 sec reload, 20.0 sec recovery) 08:17:47.916 -> 08:17:47.916 -> 08:17:47.916 ->
2. when the arduino is on and I push the reset button, the "setup" is incomplete (or cannot do the loop, IDK what happens) and relay stays in and you can see the servo do the same thing which I wrote in the point 1. I attached a video, it is showing what happens. I dont know, but maybe the in the Tank.ino there is code part which is waiting for the initial cannon fire to go to the main loop.
65
« Last post by LukeZ on January 08, 2024, 02:04:58 PM »
My happiness was not long. Unfortuntely, the phantom firing is not visible on the serial monitor, but still there. I have another idea with this, can you please put a code which activates the IR emitter pin a little bit later? I mean, the ir pin activated or start to wait the cannon function after 2 secs from bootup. I put a button state in every initial bootup but its value 1 every time. Ok, up to now I have not thoroughly re-acquainted myself with the entirety of this project, and making changes until I've done so is always a mistake. I've spent a good deal of time today looking through everything, and hopefully I have a better idea of what is going on. Ultimately what your friend did in setting the direction of the positive trigger pin to OUTPUT will not fix the phantom firing issue, though it might have improved it. The problem is we still have an interrupt defined on this pin which is causing the problems. The solution is to create another setting in A_Setup.h where the user can specify whether they want to use this input or not. I've made it the first setting in that file, and by default it will be false (disabled): #define USE_5VOLT_TRIGGER false
When false, the interrupt will not be created and the setup of the pin will be handled appropriately. There is no need for a setting for the negative-input/pushbutton trigger, that one can always be active. It uses an internal pullup so isn't subject to stray voltages, also it doesn't use a hardware interrupt procedure and should ignore anything other than a very intentional signal. Referring the reload led notification, unfortunately its not working. If I set it true its on all the time, until it gets a hit, making hit notification effect but reload notification is not active. This was an error on my part. I've corrected it and it should work now. I also increased the blink time a little bit to 400mS. MOD: I just realized I can shoot the cannon after being destroyed (during recovery time). It is not desirable, so I just modified the cannon.ino with this simple stuff (tested, working)
Wow, great catch! I can't believe I missed that. In fact the same bug is present on the TCB, I will fix that too. The GitHub is now updated with all these changes. I hope now everything will work, please let me know your results.
66
« Last post by Rongyos on January 07, 2024, 11:37:52 AM »
Ok, I understand now. You're right, these Chinese MFUs often prefer to toggle the ground signal rather than the positive, so you were correct to use the button input D4 (which triggers when held to ground) rather than the 5 volt input A0 (which triggers when brought to 5 volts). Your friend correctly identified the problem with the 5v input which was left floating, and disabled it by setting it to OUTPUT. That works fine. For others reading this, you can do the same, or as mentioned before, add a resistor between A0 and ground if you don't want to change the code.
Hi Luke! My happiness was not long. Unfortuntely, the phantom firing is not visible on the serial monitor, but still there. I have another idea with this, can you please put a code which activates the IR emitter pin a little bit later? I mean, the ir pin activated or start to wait the cannon function after 2 secs from bootup. I put a button state in every initial bootup but its value 1 every time. IDK why this dump the battle info 3 times after uploading the code ... :/ 18:27:40.756 -> Button State: 1 18:27:41.021 -> 18:27:41.021 -> --------------------------------------------- 18:27:41.021 -> BATTLE INFO 18:27:41.021 -> --------------------------------------------- 18:27:41.021 -> Is Repair Tank? No 18:27:41.021 -> Fire Protocol: Tamiya 18:27:41.021 -> Hit Protocol 2: Heng Long 18:27:41.021 -> Repaired by: Clark Repair 18:27:41.021 -> Send MG IR Code: No 18:27:41.021 -> Accept MG Damage: No 18:27:41.021 -> Damage Profile: Tamiya Spec 18:27:41.021 -> Weight Class: Medium 18:27:41.021 -> (6 cannon hits, 5.0 sec reload, 20.0 sec recovery) 18:27:41.064 -> 18:27:41.064 -> 18:27:41.064 -> 18:27:51.406 -> Button State: 1 18:27:51.671 -> 18:27:51.671 -> --------------------------------------------- 18:27:51.671 -> BATTLE INFO 18:27:51.671 -> --------------------------------------------- 18:27:51.671 -> Is Repair Tank? No 18:27:51.671 -> Fire Protocol: Tamiya 18:27:51.671 -> Hit Protocol 2: Heng Long 18:27:51.671 -> Repaired by: Clark Repair 18:27:51.714 -> Send MG IR Code: No 18:27:51.714 -> Accept MG Damage: No 18:27:51.714 -> Damage Profile: Tamiya Spec 18:27:51.714 -> Weight Class: Medium 18:27:51.714 -> (6 cannon hits, 5.0 sec reload, 20.0 sec recovery) 18:27:51.714 -> 18:27:51.714 -> 18:27:51.714 -> 18:28:27.490 -> Button State: 1 18:28:27.753 -> 18:28:27.753 -> --------------------------------------------- 18:28:27.753 -> BATTLE INFO 18:28:27.753 -> --------------------------------------------- 18:28:27.753 -> Is Repair Tank? No 18:28:27.753 -> Fire Protocol: Tamiya .... cannot copy more lines ----> Rongyos
Referring the reload led notification, unfortunately its not working. If I set it true its on all the time, until it gets a hit, making hit notification effect but reload notification is not active. MOD: I just realized I can shoot the cannon after being destroyed (during recovery time). It is not desirable, so I just modified the cannon.ino with this simple stuff (tested, working) // CANNON FIRE // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>> void FireCannon() { if (!Tank.isDestroyed) // Check if the tank is not destroyed { if (Tank.CannonReloaded()) // Only fire if reloading is complete { if (Tank.isRepairTank())
67
« Last post by LukeZ on January 07, 2024, 10:10:47 AM »
No, maybe I was not understandable, sorry if my English is not perfect. For me the "tankdestroyed" notify LED effects were very similar to simple hit notification. I just wanted some longer blinking after destroy to make it more clear for the user that the tank is out. If I modify this can I reach my goal? (More blinking time, significantly longer than simple hit notification, the value was 450ms before thats what your comment also said )
// Now set a timer to keep coming back here after a short interval so we can blink the lights DestroyedBlinkerID = TankTimer->setInterval(450, HitLEDs_Destroyed); // This is a slow blink, about half a second Yes, if you want to change the blink rate for the destroyed notification, then you can modify the 450 value that you mentioned above. If you use a smaller number the blinking will be faster, or if you use a larger number the blinking will be slower. Regardless it will continue to blink for 15 seconds (or whatever value you decide to specify for DESTROYED_INOPERATIVE_TIME_mS). Thanks Luke, my plan was to use the 4th pin of the regular 8pin connector which is the airsoft signal pin. It sends out gnd signal, so thats why I used INPUT_PULLUP function to trigger the cannon fire. I don't need the 5V receiving pin because of this. Achieving my plan will let the users use this unit with older Heng Long and Taigen boards (they just need to extend the 4th wire and connect to relevant connector to the battle unit). I also have 2 Taigens and my test were good except the "phantom firing", but with the simple solution from my friend it disappeared! Ok, I understand now. You're right, these Chinese MFUs often prefer to toggle the ground signal rather than the positive, so you were correct to use the button input D4 (which triggers when held to ground) rather than the 5 volt input A0 (which triggers when brought to 5 volts). Your friend correctly identified the problem with the 5v input which was left floating, and disabled it by setting it to OUTPUT. That works fine. For others reading this, you can do the same, or as mentioned before, add a resistor between A0 and ground if you don't want to change the code.
68
« Last post by Rongyos on January 06, 2024, 05:16:57 PM »
Hi Luke! Thank you for your support! I will try it tomorrow and share the results of your modifications As for increasing the length of the tank destroyed period, it is set to 15 seconds because that is the Tamiya standard. However if you want to change it, modify this value near the top of the Tank.h tab:
// Tanks is dead for 15 seconds #define DESTROYED_INOPERATIVE_TIME_mS 15000 // How long is the vehicle immobilized after being destroyed. 15 seconds is the Tamiya spec. After this, // the vehicle will automatically re-generate with full health restored.
No, maybe I was not understandable, sorry if my English is not perfect. For me the "tankdestroyed" notify LED effects were very similar to simple hit notification. I just wanted some longer blinking after destroy to make it more clear for the user that the tank is out. If I modify this can I reach my goal? (More blinking time, significantly longer than simple hit notification, the value was 450ms before thats what your comment also said ) // Now set a timer to keep coming back here after a short interval so we can blink the lights DestroyedBlinkerID = TankTimer->setInterval(5450, HitLEDs_Destroyed); // This is a slow blink, about half a second I guess you are using the manual pushbutton method to trigger the canon fire? Most people probably use the signal input so I suppose that is why we haven't caught this issue before. I will update the documentation to make this more clear.
Thanks Luke, my plan was to use the 4th pin of the regular 8pin connector which is the airsoft signal pin. It sends out gnd signal, so thats why I used INPUT_PULLUP function to trigger the cannon fire. I don't need the 5V receiving pin because of this. Achieving my plan will let the users use this unit with older Heng Long and Taigen boards (they just need to extend the 4th wire and connect to relevant connector to the battle unit). I also have 2 Taigens and my test were good except the "phantom firing", but with the simple solution from my friend it disappeared! I will test your led modifications and let you know! Thanks and regards Rongyos
69
« Last post by LukeZ on January 06, 2024, 11:31:16 AM »
Can I ask something? Can you add a simple led blink on HitLeds when cannon reloaded and a little bit longer blinking when tank destroyed?
Hi Rongyos, I've posted an update to the firmware to GitHub, there is now the option to have the apple Hit LEDs blink when the cannon reload time has completed. By default it is off, you can set it to true in the A_Setup.h file near the top. // NOTIFICATION LED // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->> // #define CANNON_RELOAD_NOTIFY false // << --- SET ME - set to True to blink the IR apple notification LEDs when canon reload time has transpired (CUSTOM_CANNON_RELOAD below) I'm not sure how long the blink should be, and I don't have an Arduino right now to test. Currently it is set to 250mS, which is only 1/4 of a second. If you want to increase the time, modify this function at the very bottom of Tank.cpp: //------------------------------------------------------------------------------------------------------------------------>> // HIT NOTIFICATION LEDs CANON RELOADED - Short blink to notify user the canon reload time has completed // Can be enabled/disabled with setting CANNON_RELOAD_NOTIFY on the A_Setup.h tab //------------------------------------------------------------------------------------------------------------------------>> void OP_Tank::HitLEDs_ReloadNotify(void) { HitLEDs_Blink(250); }
As for increasing the length of the tank destroyed period, it is set to 15 seconds because that is the Tamiya standard. However if you want to change it, modify this value near the top of the Tank.h tab: // Tanks is dead for 15 seconds #define DESTROYED_INOPERATIVE_TIME_mS 15000 // How long is the vehicle immobilized after being destroyed. 15 seconds is the Tamiya spec. After this, // the vehicle will automatically re-generate with full health restored.
Finally, with regard to the "phantom firing" - I probably should have made this more clear, though it is shown in the included sample schematic PDF - but you need to place a resistor between A0 and ground. 10k is shown in the schematic though the value is not important. What you have done by setting A0 (pin_VoltageTrigger) to OUTPUT will also work, but then of course you would have to change that if you were going to use this pin in the future as an input signal from some other MFU. I guess you are using the manual pushbutton method to trigger the canon fire? Most people probably use the signal input so I suppose that is why we haven't caught this issue before. I will update the documentation to make this more clear.
70
« Last post by Rongyos on January 04, 2024, 12:53:03 PM »
I have a suspicion this is related to the Arduino IDE version issue that was discussed earlier in this thread. With certain versions of the IDE the code will compile but without enough memory available, and the sketch will operate very erratically, if at all.
You were right, I try to get stable 5v from anywhere, uploaded sketch to 4 different nanos and so on but didn't find that solution Thanks, everything working. I downloaded the IDE 1.8.5 and board 1.6.20 Can I ask something? Can you add a simple led blink on HitLeds when cannon reloaded and a little bit longer blinking when tank destroyed?
I tried the reload blink like this, but no success: void OP_Tank::HitLEDs_Reloaded(void) { if (CannonReloaded) { HitLEDs_Toggle(); } else { if (TankTimer->isEnabled(HitLED_TimerID)) TankTimer->deleteTimer(HitLED_TimerID); HitLEDs_Off(); } Also, look at the test, I call it "almost there" Unfortunately, fantom firing is still there 19:07:13.025 -> BATTLE INFO 19:07:13.025 -> --------------------------------------------- 19:07:13.025 -> Is Repair Tank? No 19:07:13.025 -> Fire Protocol: Tamiya 19:07:13.025 -> Hit Protocol 2: Heng Long 19:07:13.025 -> Repaired by: Clark Repair 19:07:13.025 -> Send MG IR Code: No 19:07:13.025 -> Accept MG Damage: No 19:07:13.071 -> Damage Profile: Tamiya Spec 19:07:13.071 -> Weight Class: Medium 19:07:13.071 -> (6 cannon hits, 5.0 sec reload, 12.0 sec recovery) 19:07:13.071 -> 19:07:13.071 -> 19:07:13.071 ->
19:07:15.205 -> Fire Cannon
19:07:31.516 -> CANNON HIT! (Tamiya) 19:07:31.516 -> Health Level: 83% 19:07:41.921 -> CANNON HIT! (Tamiya) 19:07:41.921 -> Health Level: 67% 19:07:52.162 -> CANNON HIT! (Tamiya) 19:07:52.162 -> Health Level: 50% 19:08:02.223 -> CANNON HIT! (Tamiya) 19:08:02.223 -> Health Level: 33% 19:08:12.900 -> CANNON HIT! (Tamiya) 19:08:12.900 -> Health Level: 17% 19:08:23.038 -> CANNON HIT! (Tamiya) 19:08:23.038 -> Health Level: 0% 19:08:33.440 -> CANNON HIT! (Tamiya) 19:08:33.440 -> Health Level: 0% 19:08:33.440 -> TANK DESTROYED 19:08:48.467 -> TANK RESTORED
EDIT: I tried to rewrite the button state on the TankIR loop from wasReleased to isPressed and wasPressed, no success I use INPUT_PULLUP pinmode for my input pin, changed back to INPUT but phantom firing still there. Don't know whats next. Of course, there is no periphery attached to arduino when I checked this on tests, only the Nano was attached to USB.My friend helped me. I set the VoltageTrigger to OUTPUT and no phantom firing occured
Pages: 1 ... 4 5 6 [7] 8 9 10
|