View Single Post
Old 08-05-2023, 06:38 AM   #99 (permalink)
t vago
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
Quote:
Originally Posted by abbalooga View Post
1. The MPGuino shouldn't pause? There's no code that causes a wait every 7 cycles (3.5 seconds). Hmmm.. Thats news to me! None of the units I have here seem to do that, I'll look into it! Is that on the hardware as I shipped it?
It's a pause of 1/2 a second, that occurs once every 3.5 seconds. I, ah, didn't test the hardware before I started developing my code to run on it, but I have flashed the hardware with v25 of your code and I have seen this behavior there.

It's not a big deal otherwise, and I'm not even sure it could be classified as a bug. The original 0.86 version of MPGuino, and the meelis11 version you based your code on, didn't really lend itself well to supporting anything besides a standard 16x2 LCD, which is one of the reasons why I created my code. That you were able to get both TFT, touch, and Bluetooth support to work with this code is actually pretty impressive. This periodic delay might well be necessary with your code - I just don't know.

I can modify my code to duplicate this behavior if it is needed for something that I didn't otherwise take into account. Heck, adding this behavior might solve the bug I am seeing in my code, that it occasionally just stops sending updates to the app once a parameter is changed, even though it received the "resume display" command from the app.

Here's the relevant part of your code. I've boldfaced the lines that cause this behavior to manifest.

Code:
  //senddd=0;
  if (senddd==1) {	// output state machine set to output selected trip functions
    loopnz=loopnz+1;			// output selected function result list, 7 out of 8 loops
    if (loopnz>=2 && loopnz<=8){
      Serial1.print("U"+String(parms[currentTripResetTimeoutUSIdx]));
      delay2(20);
      Serial1.print("A"+String(instantmph()/10));
      delay2(20); 
      Serial1.print("B"+String(batteryVoltage()));
      delay2(20); 
      Serial1.print("C"+String(tank.gallons()/10));
      delay2(20); 
      Serial1.print("D"+String(current.miles()/10));
      delay2(20); 
      Serial1.print("E"+String(tank.miles()/10));
      delay2(20); 
      Serial1.print("F"+String(getDTE()/10));
      delay2(20);
      Serial1.print("G"+String(instantrpm()/1000));
      delay2(20);
      if(instantmph()==0) 
        Serial1.print("H"+String(instantgph()/10));
      else 
        Serial1.print("H"+String(instantmpg()/10));
      delay2(20);
      Serial1.print("I"+String(current.mpg()/10));
      delay2(20);
      Serial1.print("J"+String(tank.mpg()/10));
      delay2(20);
      Serial1.print("L"+String(current.gallons()/10));
      delay2(20);

    }
  }
  if (loopnz==8) {
    //senddd=2;
    loopnz=0;
  }
Quote:
Originally Posted by abbalooga View Post
2. AH! the pause on refill. Is this when you try and refill from the app? I'll look into that too.
Yes. Probably just need to ensure the app transmits the "resume display" command if either the "RESET TRIP" or the "REFILL TANK" options are cancelled out of.

Quote:
Originally Posted by abbalooga View Post
3. Is that an issue? A rouge 0 shouldn't affect things but I'll see where it comes from.
Nope, it's not an issue at all. I was thinking perhaps you included it to add some sort of functionality in the future. I currently save that value the smartphone sends, but I don't do anything else with it.

Quote:
Originally Posted by abbalooga View Post
I haven't run into any problems using the APP with the units as they're shipped. I haven't come across the pause when cancelling a refill though, that's important to fix!

I appreciate the bugs man! I'll fix them asap.
Thank you for your help and support! I am looking forward to getting TFT and touch support added - one of the things I want to incorporate is some basic gesture support within the touchscreen.
  Reply With Quote
The Following User Says Thank You to t vago For This Useful Post:
abbalooga (08-05-2023)