Added iq and id

This commit is contained in:
CommanderRedYT
2022-09-17 17:38:53 +02:00
parent 4885913c75
commit c129106ff4
3 changed files with 16 additions and 0 deletions

View File

@ -161,6 +161,18 @@ bool parseMotorControllerCanMessage(const twai_message_t &message, Controller &c
case MotorController<isBack, true>::Feedback::Temp:
controller.feedback.boardTemp = *((int16_t*)message.data);
return true;
case MotorController<isBack, false>::Feedback::Id:
controller.feedback.left.id = *((int16_t*)message.data);
return true;
case MotorController<isBack, true>::Feedback::Id:
controller.feedback.right.id = *((int16_t*)message.data);
return true;
case MotorController<isBack, false>::Feedback::Iq:
controller.feedback.left.iq = *((int16_t*)message.data);
return true;
case MotorController<isBack, true>::Feedback::Iq:
controller.feedback.right.iq = *((int16_t*)message.data);
return true;
}
return false;

View File

@ -77,6 +77,8 @@ private:
struct DcPhaCFixedText : public virtual TextInterface { public: std::string text() const override { std::string line{"dcPhaC: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().dcPhaC)); return line; } };
struct ChopsText : public virtual TextInterface { public: std::string text() const override { std::string line{"chops: "}; if (controller::get().feedbackValid) line += std::to_string(MotorFeedbackGetter::get().chops); return line; } };
struct HallText : public virtual TextInterface { public: std::string text() const override { std::string line{"hall: "}; if (controller::get().feedbackValid) line += hallString(MotorFeedbackGetter::get()); return line; } };
struct IdText : public virtual TextInterface { public: std::string text() const override { std::string line{"id: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().id)); return line; } };
struct IqText : public virtual TextInterface { public: std::string text() const override { std::string line{"iq: "}; if (controller::get().feedbackValid) line += fmt::format("{:.2f}A", fixCurrent(MotorFeedbackGetter::get().iq)); return line; } };
};
public:

View File

@ -35,6 +35,8 @@ public:
constructMenuItem<makeComponent<MenuItem, typename Ttexts::DcPhaCFixedText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, typename Ttexts::ChopsText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, typename Ttexts::HallText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, typename Ttexts::IqText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, typename Ttexts::IdText, ColorInterface<TFT_DARKGREY>, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&espgui::icons::back>>>();
}