/// <summary/> public bool SetPWMOutputEnable(PWMOutputConfig? enable, bool confirm) { bool status = false; try { CommandDefinition.CommandFormat command = CommandMake(CommandEnum.PWMOutput, BooleanValue.True, ActionEnum.Set, (byte)enable); CommandDefinition.CommandFormat? reply = CommandSend(command, /*reply expected*/ true); if (/*ignore results?*/ !confirm) status = true; else { string text = CommandReplyValidate(reply, CommandEnum.PWMOutput, (byte)enable); if (/*fail?*/ text != string.Empty) throw new Exception(text); status = true; } } catch (Exception ex) { Debug.Assert(!status); if (/*OK to log?*/ LogPauseExpired) try { Logger.LogError(Utilities.TextTidy(ex.ToString())); } catch { } } #if DEBUG try { Logger.LogInfo(MethodBase.GetCurrentMethod() + "(" + ((enable == null) ? "null" : enable.ToString()) + ", " + confirm.ToString() + ") returns " + status.ToString()); } catch { } #endif return status; }
public bool SetPWMOutputEnable(PWMOutputConfig? /*enabled?*/ Enb, bool /*confirm*/ Cnf) { string /*trace text*/ trc = MethodBase.GetCurrentMethod().Name + "(" + ((Enb != null) ? Enb.ToString() : "null") + ", " + Cnf.ToString() + ")"; bool /*status (returned)*/ sts = false; try { CommandDefinition.CommandFormat /*command */ cmd = ConstructCommand( CommandEnum.PWMOutput, BooleanValue.True, ActionEnum.Set, (byte)Enb); CommandDefinition.CommandFormat? /*response*/ rsp = SendCommand(cmd, Cnf); sts = !Cnf || ConfirmSetActionResponse(rsp, CommandEnum.PWMOutput, (byte)Enb); } catch (Exception ex) { Lgr.LogError(ex); } return sts; }