Simpit-team / KerbalSimpitRevamped

A revamp of the Kerbal Simpit Mod for KSP
BSD 2-Clause "Simplified" License
26 stars 15 forks source link

[BUG]: EVA Propellant message is not being sent (EVA_MESSAGE) #62

Closed CodapopKSP closed 3 years ago

CodapopKSP commented 3 years ago

Description of the bug

EVA propellant message doesn't appear to be sent. Other fuel messages get sent and displayed properly, but EVA doesn't appear to work. I believe this has to do with Alternate Resource Panel not displaying EVA prop while on EVA.

Using SF_MESSAGE properly displays solid fuel on the ship, but EVA_MESSAGE retrieves nothing.

While on EVA, EVA prop is shown in the regular resources panel, but not ARP, and it doesn't appear to be retrievable by Simpit. Retrieved value appears to be either 0 or null.

Mod version: alpha 6

Game version: 1.11

Operating system: Win 10

Microprocessor/s in use: arduino nano

LRTNZ commented 3 years ago

Do we know if a Kerbal is considered a Vessel when in EVA? https://github.com/TriggerAu/AlternateResourcePanel/blob/develop/AlternateResourcePanel/API/ARPWrapper.cs

PBechon commented 3 years ago

I did not manage to reproduce it.

When I load the EVA training, I have the EVA fuel displayed in the ARP panel and I receive ressources messages for EVA fuel.

Here is a screenshot with ARP panel opened : screenshot6

Below is a minimum Arduino code to read the EVA values, lit the builtin led when the fuel is below 4.5 and echo back the values to KSP. It works as intented on my side.

What version of KSP are you using ? What other mods are you using that can interfere with ARP ?


#include "KerbalSimpit.h"

KerbalSimpit mySimpit(Serial);

void setup() {
  // Open the serial connection.
  Serial.begin(115200);

  // Set initial pin states, and turn on the LED
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(LED_BUILTIN, HIGH);

  // This loop continually attempts to handshake with the plugin.
  // It will keep retrying until it gets a successful handshake.
  while (!mySimpit.init()) {
    delay(100);
  }
  // Turn off the built-in LED to indicate handshaking is complete.
  digitalWrite(LED_BUILTIN, LOW);

  mySimpit.printToKSP("Connected", PRINT_TO_SCREEN);

  //delay(1000);
  mySimpit.inboundHandler(messageHandler);

  mySimpit.registerChannel(EVA_MESSAGE);
}

void messageHandler(byte messageType, byte msg[], byte msgSize) {
  switch(messageType) {
    case EVA_MESSAGE:
      // Checking if the message is the size we expect is a very basic
      // way to confirm if the message was received properly.
      //if (msgSize == sizeof(TACLSRessourceMessage)) {
        resourceMessage myMsg;
        myMsg = parseResource(msg);
        if(myMsg.available > 4.5){
          digitalWrite(LED_BUILTIN, LOW);
        } else {
          digitalWrite(LED_BUILTIN, HIGH);
        }
        mySimpit.printToKSP("Eva remaining : " + String(myMsg.available));
      break;
  }
}

void loop() {
  mySimpit.update();
}
PBechon commented 3 years ago

Issue was confirmed when using KSP>=1.11. The issue was already reported in ARP.

Issue fixed in cbdc0463f2045fc1e72d21810326172a7c1032c6 by computing the EVA fuel without calling ARP