Add mesh value feedback

This commit is contained in:
InsanityAutomation
2020-12-15 13:52:37 -05:00
parent b7d5374020
commit 241c27e636
3 changed files with 36 additions and 2 deletions
@@ -174,6 +174,26 @@ bool hasPrintTimer = false;
void onConfigurationStoreRead(bool success) {
// Called after the entire EEPROM has been read,
// whether successful or not.
#if HAS_MESH
if (ExtUI::getMeshValid())
{
uint8_t abl_probe_index = 0;
for(uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
{
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++)
{
uint8_t x_Point = inner;
bool zig = (outer & 1);
if (zig) x_Point = (GRID_MAX_POINTS_X - 1) - inner;
xy_uint8_t point = {x_Point, outer};
dgusdisplay.WriteVariable( (VP_MESH_VALUE_START + (abl_probe_index * 2)), static_cast<uint16_t>(ExtUI::getMeshPoint(point) * 1000));
++abl_probe_index;
}
}
setLevelingActive(true);
}
#endif
}
#if HAS_MESH
@@ -497,6 +497,21 @@ void DGUSScreenHandler::OnMeshLevelingUpdate(const int8_t xpos, const int8_t ypo
// Update icon
dgusdisplay.WriteVariable(VP_MESH_LEVEL_STATUS, static_cast<uint16_t>(MeshLevelIndex));
uint8_t abl_probe_index = 0;
for(uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
{
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++)
{
uint8_t x_Point = inner;
bool zig = (outer & 1); // != ((PR_OUTER_END) & 1);
if (zig) x_Point = (GRID_MAX_POINTS_X - 1) - inner;
xy_uint8_t point = {x_Point, outer};
if(x_Point==xpos && outer ==ypos)
dgusdisplay.WriteVariable( (VP_MESH_VALUE_START + (abl_probe_index * 2)), static_cast<uint16_t>(ExtUI::getMeshPoint(point) * 1000));
++abl_probe_index;
}
}
if (MeshLevelIndex == GRID_MAX_POINTS) {
// Done
thermalManager.disable_all_heaters();
@@ -504,8 +519,6 @@ void DGUSScreenHandler::OnMeshLevelingUpdate(const int8_t xpos, const int8_t ypo
settings.save();
GotoScreen(DGUSLCD_SCREEN_ZOFFSET_LEVEL);
} else {
// We've already updated the icon, so nothing left
}
}
@@ -338,6 +338,7 @@ constexpr uint16_t VP_LED_TOGGLE = 0x101F;
constexpr uint16_t VP_STEPPERS = 0x1200;
constexpr uint16_t VP_MESH_LEVEL_TEMP = 0x108A;
constexpr uint16_t VP_MESH_LEVEL_STATUS = 0x108D;
constexpr uint16_t VP_MESH_VALUE_START = 0x1300;
constexpr uint16_t VP_FEED_AMOUNT = 0x1054;
constexpr uint16_t VP_FEED_PROGRESS = 0x108e;