Report detected MMU version in the Support menu

It was just subtly broken, all the functionality had already been implemented.
This commit is contained in:
D.R.racer 2022-06-21 07:37:54 +02:00
parent 121d43f896
commit dab26fe50b
4 changed files with 26 additions and 9 deletions

View File

@ -146,7 +146,7 @@ public:
/// In the future we'll return the trully detected FW version
Version GetMMUFWVersion()const {
if( State() == xState::Active ){
return { 2, 0, 0 };
return { logic.MmuFwVersionMajor(), logic.MmuFwVersionMinor(), logic.MmuFwVersionBuild() };
} else {
return { 0, 0, 0};
}

View File

@ -145,7 +145,8 @@ StepStatus StartSeq::Step() {
// solve initial handshake
switch (state) {
case State::S0Sent: // received response to S0 - major
if (logic->rsp.paramValue != 2) {
logic->mmuFwVersionMajor = logic->rsp.paramValue;
if (logic->mmuFwVersionMajor != 2) {
return VersionMismatch;
}
logic->dataTO.Reset(); // got meaningful response from the MMU, stop data layer timeout tracking
@ -153,14 +154,16 @@ StepStatus StartSeq::Step() {
state = State::S1Sent;
break;
case State::S1Sent: // received response to S1 - minor
if (logic->rsp.paramValue != 0) {
logic->mmuFwVersionMinor = logic->rsp.paramValue;
if (logic->mmuFwVersionMinor != 0) {
return VersionMismatch;
}
logic->SendMsg(RequestMsg(RequestMsgCodes::Version, 2));
state = State::S2Sent;
break;
case State::S2Sent: // received response to S2 - revision
if (logic->rsp.paramValue != 0) {
logic->mmuFwVersionBuild = logic->rsp.paramValue;
if (logic->mmuFwVersionBuild != 0) {
return VersionMismatch;
}
// Start General Interrogation after line up.

View File

@ -227,15 +227,26 @@ public:
Buttons Button() const { return buttonCode; }
uint8_t CommandInProgress()const;
inline bool Running()const {
return state == State::Running;
}
inline bool FindaPressed() const {
return findaPressed;
}
inline uint8_t MmuFwVersionMajor() const {
return mmuFwVersionMajor;
}
inline uint8_t MmuFwVersionMinor() const {
return mmuFwVersionMinor;
}
inline uint16_t MmuFwVersionBuild() const {
return mmuFwVersionBuild;
}
#ifndef UNITTEST
private:
#endif
@ -305,9 +316,12 @@ private:
Buttons buttonCode; ///< Last received button from the MMU.
uint8_t lastFSensor; ///< last state of filament sensor
bool findaPressed;
uint8_t mmuFwVersionMajor, mmuFwVersionMinor;
uint16_t mmuFwVersionBuild;
friend class ProtocolLogicPartBase;
friend class Stopped;
friend class Command;

View File

@ -1706,7 +1706,7 @@ static void lcd_support_menu()
{
lcd_set_cursor(6, menu_row);
MMU2::Version mmu_version = MMU2::mmu2.GetMMUFWVersion();
if ((mmu_version.major > 0) && (mmu_version.build > 0))
if (mmu_version.major > 0)
lcd_printf_P(PSTR("%d.%d.%d"), mmu_version.major, mmu_version.minor, mmu_version.build);
else
lcd_puts_P(_i("unknown")); ////MSG_UNKNOWN c=13