Skip to content

Commit

Permalink
[Examples]: Finalize first version of advanced example
Browse files Browse the repository at this point in the history
Added multiple speed source selection to seeder example.
Added lots of TC enhancements to the seeder example, now reporting
seed counts instead of random other things and properly reporting some
values that the TC is requesting instead of sending zeros.
Alarm updates, add enable/disable.
  • Loading branch information
ad3154 committed Jul 23, 2023
1 parent 06e2665 commit 5f9fffd
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 92 deletions.
Binary file modified examples/seeder_example/BasePool.iop
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/seeder_example/object_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define speedReadout_Container 3026 //0x0BD2
#define noTcAlarmLine_Container 3027 //0x0BD3
#define noSpeedAlarmLine_Container 3028 //0x0BD4
#define enableAlarms_Container 3029 //0x0BD5
#define mainRunscreen_SoftKeyMask 4000 //0x0FA0
#define alarm_SKeyMask 4001 //0x0FA1
#define returnHome_SKeyMask 4002 //0x0FA2
Expand All @@ -63,6 +64,7 @@
#define section5Toggle_Button 6004 //0x1774
#define section6Toggle_Button 6005 //0x1775
#define autoManualToggle_Button 6006 //0x1776
#define enableAlarms_InBool 7000 //0x1B58
#define statistics_InList 10000 //0x2710
#define Title_OutStr 11000 //0x2AF8
#define onOffIconCredit_OutStr 11001 //0x2AF9
Expand Down Expand Up @@ -102,6 +104,7 @@
#define noActiveAlarms_OutStr 11035 //0x2B1B
#define NoTaskController_OutStr 11036 //0x2B1C
#define NoMachineSpeed_OutStr 11037 //0x2B1D
#define enableAlarms_OutStr 11038 //0x2B1E
#define busload_OutNum 12000 //0x2EE0
#define canAddress_OutNum 12001 //0x2EE1
#define utVersion_OutNum 12002 //0x2EE2
Expand Down Expand Up @@ -158,6 +161,7 @@
#define tcControlChannels_VarNum 21010 //0x5212
#define currentSpeedMeter_VarNum 21011 //0x5213
#define currentSpeedReadout_VarNum 21012 //0x5214
#define enableAlarms_VarNum 21013 //0x5215
#define title_OutStr 22000 //0x55F0
#define onOffIconsCredit_VarStr 22001 //0x55F1
#define alarmMaskTitle_VarStr 22002 //0x55F2
Expand Down Expand Up @@ -189,6 +193,7 @@
#define noTCSummary_VarStr 22028 //0x560C
#define currentAlarms_VarStr 22029 //0x560D
#define noActiveAlarms_VarStr 22030 //0x560E
#define enableAlarms_VarStr 22031 //0x560F
#define temp_FontAttr_ID_23000 23000 //0x59D8
#define temp_FontAttr_ID_23001 23001 //0x59D9
#define black48x64_FontAttr 23002 //0x59DA
Expand Down
119 changes: 99 additions & 20 deletions examples/seeder_example/section_control_implement_sim.cpp

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions examples/seeder_example/section_control_implement_sim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SectionControlImplementSimulator
GranularProduct, ///< The main bin element that describes the main product
BinCapacity, ///< The max bin content for the product device element
BinLevel, ///< Actual Device Element Content specified as volume
LifetimeApplicationVolumeTotal, ///< https://www.isobus.net/isobus/dDEntity/400
LifetimeApplicationCountTotal,
PrescriptionControlState, ///< https://www.isobus.net/isobus/dDEntity/203
ActualCulturalPractice, ///< https://www.isobus.net/isobus/dDEntity/205
TargetRate, ///< The target rate for the rate controller main product
Expand All @@ -101,8 +101,8 @@ class SectionControlImplementSimulator
TimePresentation, ///< Describes to the TC how to display time units
ShortWidthPresentation, ///< Describes to the TC how to display small width units
LongWidthPresentation, ///< Describes to the TC how to display large width units
MassPresentation, ///< Describes to the TC how to display volume units
MassPerAreaPresentation ///< Describes to the TC how to display volume per area units
CountPresentation, ///< Describes to the TC how to display volume units
CountPerAreaPresentation ///< Describes to the TC how to display volume per area units
};

/// @brief Constructor for the simulator
Expand All @@ -125,6 +125,15 @@ class SectionControlImplementSimulator
/// @param[in] index The index of the section to get the state for
bool get_section_state(std::uint8_t index) const;

/// @brief Sets the current commanded section state by index
/// @param[in] index The index of the section state to set
/// @param[in] value The new state for the section
void set_section_setpoint_state(std::uint8_t index, bool value);

/// @brief Returns the current section setpoint state by index
/// @param[in] index The index of the section to get the setpoint state for
bool get_section_setpoint_state(std::uint8_t index) const;

/// @brief Sets the current section's switch state by index
/// @param[in] index The index of the switch to set
/// @param[in] value The new state for the switch
Expand All @@ -142,6 +151,10 @@ class SectionControlImplementSimulator
/// @param[in] value The rate to set
void set_target_rate(std::uint32_t value);

/// @brief Returns the current target rate
/// @returns Current target rate in seeds per hectare
std::uint32_t get_target_rate() const;

/// @brief Returns the actual work state of the device
bool get_actual_work_state() const;

Expand Down Expand Up @@ -194,11 +207,13 @@ class SectionControlImplementSimulator

private:
static constexpr std::uint8_t NUMBER_SECTIONS_PER_CONDENSED_MESSAGE = 16; ///< Number of section states in a condensed working state message
static constexpr std::int32_t BOOM_WIDTH = 9144; // 30ft expressed in mm

std::vector<bool> sectionStates; ///< Stores the commanded section states as a set of boolean values
std::vector<bool> sectionStates; ///< Stores the actual section states as a set of boolean values
std::vector<bool> sectionSetpoints; ///< Stores the commanded section states as a set of boolean values
std::vector<bool> switchStates; ///< Stores the UT section switch states as a set of boolean values
std::uint32_t targetRate = 0; ///< The target rate
bool setpointWorkState = false; ///< The overall work state
std::uint32_t targetRate = 12000; ///< The target rate, default of 12k seeds per hectare
bool setpointWorkState = true; ///< The overall work state
bool isAutoMode = true; ///< Stores auto vs manual mode setting
};

Expand Down
1 change: 1 addition & 0 deletions examples/seeder_example/seeder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void Seeder::terminate()
if (nullptr != VTApplication)
{
VTApplication->VTClientInterface.terminate();
VTApplication->TCClientInterface.terminate();
}
isobus::CANHardwareInterface::stop();
}
Expand Down
Loading

0 comments on commit 5f9fffd

Please sign in to comment.