Duet3D / PanelDueFirmware

Firmware for the PanelDue touch screen for 3D printers
Other
165 stars 84 forks source link

Implement support for new M291 message box modes #285

Closed mfs12 closed 1 year ago

mfs12 commented 1 year ago

Description

Description

Refer to

implement new message box modes and parameters.

new message box modes

new message box parameters

mfs12 commented 1 year ago

definition of the messageBox object in the object model:

{ "axisControls", OBJECT_MODEL_FUNC_IF(self->mode == 2 || self->mode == 3, (int32_t)self->controls.GetRaw()),   ObjectModelEntryFlags::important },
{ "cancelButton", OBJECT_MODEL_FUNC(self->limits.canCancel), ObjectModelEntryFlags::important },
{ "choices", OBJECT_MODEL_FUNC_IF(self->mode == 4, self->limits.choices),   ObjectModelEntryFlags::important },
{ "default", OBJECT_MODEL_FUNC_IF(self->mode >= 4, self->limits.defaultVal),    ObjectModelEntryFlags::important },
{ "max", OBJECT_MODEL_FUNC_IF(self->mode >= 5, self->limits.maxVal), ObjectModelEntryFlags::important },
{ "message", OBJECT_MODEL_FUNC(self->message.c_str()), ObjectModelEntryFlags::important },
{ "min", OBJECT_MODEL_FUNC_IF(self->mode >= 5, self->limits.minVal), ObjectModelEntryFlags::important },
{ "mode", OBJECT_MODEL_FUNC((int32_t)self->mode), ObjectModelEntryFlags::important },
{ "seq", OBJECT_MODEL_FUNC((int32_t)self->seq), ObjectModelEntryFlags::important },
{ "timeout", OBJECT_MODEL_FUNC((int32_t)self->timeout), ObjectModelEntryFlags::important },
{ "title", OBJECT_MODEL_FUNC(self->title.c_str()), ObjectModelEntryFlags::important }

@dc42 wrote:

The cancelButton, choices, default, min and max fields are new in 3.5. The mode field can take new values in 3.5. See M291 in the GCodes wiki for the new mode values and the values of the new fields.

mfs12 commented 1 year ago

@dc42 what is the max number of choices? which string length shall each have?

mfs12 commented 1 year ago

@dc42 is there a max length of strings to enter? if so what is it?

dc42 commented 1 year ago

The only limits currently are:

  1. Maximum length of any GCode command, including M291 commands. This is currently 256 bytes. However, a command that uses variable substitution could exceed this limit.
  2. Currently, indiividual strings can't exceed 100 characters each. However, this is about to be increased to 256.

I suggest you define and we document a maximum length of each string and a maximum number of choices that can be displayed on PanelDue. This number could be lower on the 4.3" display than on the 5" and 7". Longer strings should be truncated, which the text writing functions on PanelDue do anyway.

mfs12 commented 1 year ago

well just wondering... with all the statically allocated memory perhaps i should check overall memory consumption. In general i would suggest a limit of 32 including terminating 0 as decent limit for choices.

dc42 commented 1 year ago

That sounds reasonable. What length text will fit on the 800x480 screen of the 5" and 7" displays?