aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-05-21 21:21:49 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-05-21 21:21:49 +0300
commitb9858454b21aa53f818a5a148e8ad1e75d13a83d (patch)
tree2637bf0f3e3e9ea2920e1aaffde0bffc88cf3eb2
parent4c3be889e920102408b0927c5f595ada5a6a544f (diff)
downloadTango-b9858454b21aa53f818a5a148e8ad1e75d13a83d.tar.gz
Tango-b9858454b21aa53f818a5a148e8ad1e75d13a83d.zip
Some more work on idle and power down request.
-rw-r--r--Software/PMR/Messages/MachineStatus/SetPowerDownTimeRequest.proto3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs38
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs14
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs7
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs8
-rw-r--r--Software/Visual_Studio/Tango.PMR/MachineStatus/SetPowerDownTimeRequest.cs69
8 files changed, 99 insertions, 57 deletions
diff --git a/Software/PMR/Messages/MachineStatus/SetPowerDownTimeRequest.proto b/Software/PMR/Messages/MachineStatus/SetPowerDownTimeRequest.proto
index e5c683999..99ac230ba 100644
--- a/Software/PMR/Messages/MachineStatus/SetPowerDownTimeRequest.proto
+++ b/Software/PMR/Messages/MachineStatus/SetPowerDownTimeRequest.proto
@@ -5,5 +5,6 @@ option java_package = "com.twine.tango.pmr.machinestatus";
message SetPowerDownTimeRequest
{
- int32 TimeoutMinutes = 1;
+ int32 TimeToIdleMinutes = 1;
+ int32 TimeToPowerOffMinutes = 2;
} \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index 594d3f5c9..f6b31d93c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -46,7 +46,7 @@ namespace Tango.PPC.MachineSettings.ViewModels
public class PowerDownTime
{
- public PowerDownMinutes Minutes { get; set; }
+ public PowerSavingModes Minutes { get; set; }
public String Name
{
@@ -292,13 +292,20 @@ namespace Tango.PPC.MachineSettings.ViewModels
set { _manualFineTuningLength = value; RaisePropertyChangedAuto(); }
}
- public List<PowerDownTime> PowerDownTimes { get; set; }
+ public List<PowerDownTime> PowerSavingModes { get; set; }
- private PowerDownTime _selectedPowerDownTime;
- public PowerDownTime SelectedPowerDownTime
+ private PowerDownTime _selectedPoweroffTime;
+ public PowerDownTime SelectedPowerOffTime
{
- get { return _selectedPowerDownTime; }
- set { _selectedPowerDownTime = value; RaisePropertyChangedAuto(); }
+ get { return _selectedPoweroffTime; }
+ set { _selectedPoweroffTime = value; RaisePropertyChangedAuto(); }
+ }
+
+ private PowerDownTime _selectedIdleTime;
+ public PowerDownTime SelectedIdleTime
+ {
+ get { return _selectedIdleTime; }
+ set { _selectedIdleTime = value; RaisePropertyChangedAuto(); }
}
@@ -330,12 +337,12 @@ namespace Tango.PPC.MachineSettings.ViewModels
DiscardCommand = new RelayCommand(Discard);
SynchronizeCommand = new RelayCommand(Synchronize, () => !MachineDataSynchronizer.IsSynchronizing && IsFree);
- PowerDownTimes = new List<PowerDownTime>()
+ PowerSavingModes = new List<PowerDownTime>()
{
- new PowerDownTime() { Minutes = PowerDownMinutes.Minimum },
- new PowerDownTime() { Minutes = PowerDownMinutes.Default },
- new PowerDownTime() { Minutes = PowerDownMinutes.Maximum },
- new PowerDownTime() { Minutes = PowerDownMinutes.Never },
+ new PowerDownTime() { Minutes = Common.PowerSavingModes.Minimum },
+ new PowerDownTime() { Minutes = Common.PowerSavingModes.Default },
+ new PowerDownTime() { Minutes = Common.PowerSavingModes.Maximum },
+ new PowerDownTime() { Minutes = Common.PowerSavingModes.Never },
};
}
@@ -369,7 +376,9 @@ namespace Tango.PPC.MachineSettings.ViewModels
Settings.LubricationLevels = LubricationLevels.Where(x => x.LubricationLevel != LubricationLevel.Standard).Select(x => x.ToRmlLubricationLevel()).ToList();
Settings.DefaultTabColorSpace = DefaultTabColorSpace;
Settings.FineTuningTrialLengthMeters = FineTuningLength;
- Settings.PowerSavingMode = SelectedPowerDownTime.Minutes;
+
+ Settings.PowerSavingModeIdle = SelectedIdleTime.Minutes;
+ Settings.PowerSavingModePowerOff = SelectedPowerOffTime.Minutes;
MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics;
@@ -391,7 +400,7 @@ namespace Tango.PPC.MachineSettings.ViewModels
{
try
{
- await MachineProvider.MachineOperator.SetPowerDownTime((int)Settings.PowerSavingMode);
+ await MachineProvider.MachineOperator.SetPowerSavingMode((int)Settings.PowerSavingModeIdle, (int)Settings.PowerSavingModePowerOff);
}
catch { }
}
@@ -561,7 +570,8 @@ namespace Tango.PPC.MachineSettings.ViewModels
ExternalBridgePassword = Settings.ExternalBridgePassword;
- SelectedPowerDownTime = PowerDownTimes.FirstOrDefault(x => x.Minutes == Settings.PowerSavingMode);
+ SelectedIdleTime = PowerSavingModes.FirstOrDefault(x => x.Minutes == Settings.PowerSavingModeIdle);
+ SelectedPowerOffTime = PowerSavingModes.FirstOrDefault(x => x.Minutes == Settings.PowerSavingModePowerOff);
_enableRemoteAssistance = RemoteAssistanceProvider.IsEnabled;
RaisePropertyChanged(nameof(EnableRemoteAssistance));
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index a1414f60c..3e2eff01c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -30,7 +30,7 @@
<ObjectDataProvider x:Key="PowerDownTimes" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
- <x:Type TypeName="common:PowerDownMinutes"/>
+ <x:Type TypeName="common:PowerSavingModes"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</UserControl.Resources>
@@ -367,16 +367,11 @@
<touch:TouchExpander Margin="0 20 0 0" Header="Power Saving" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Visibility="{Binding BuildProvider.IsEureka,Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
- <TextBlock VerticalAlignment="Center">
- <Run>
- Automatically turn off the machine on idle time after
- </Run>
- </TextBlock>
-
- <touch:TouchComboBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerDownTimes}" SelectedItem="{Binding SelectedPowerDownTime}" ValuePath="Minutes" DisplayMemberPath="Name">
-
- </touch:TouchComboBox>
+ <TextBlock VerticalAlignment="Center">Machine goes to idle mode automatically after</TextBlock>
+ <touch:TouchComboBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerSavingModes}" SelectedItem="{Binding SelectedIdleTime}" ValuePath="Minutes" DisplayMemberPath="Name"></touch:TouchComboBox>
+ <TextBlock VerticalAlignment="Center">Power off the machine when idle for</TextBlock>
+ <touch:TouchComboBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" ItemsSource="{Binding PowerSavingModes}" SelectedItem="{Binding SelectedPowerOffTime}" ValuePath="Minutes" DisplayMemberPath="Name"></touch:TouchComboBox>
</controls:TableGrid>
<!--<DockPanel Margin="10 -50 0 0">
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
index 7a5a14ede..2539985c5 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -451,7 +451,7 @@ namespace Tango.PPC.Common.Connection
try
{
var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
- await MachineOperator.SetPowerDownTime((int)settings.PowerSavingMode);
+ await MachineOperator.SetPowerSavingMode((int)settings.PowerSavingModeIdle, (int)settings.PowerSavingModePowerOff);
}
catch { }
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index 711443da5..9b6adec53 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -23,7 +23,7 @@ namespace Tango.PPC.Common
ExternalTCP,
}
- public enum PowerDownMinutes
+ public enum PowerSavingModes
{
[Description("30 Minutes")]
Minimum = 30,
@@ -398,16 +398,22 @@ namespace Tango.PPC.Common
}
/// <summary>
- /// Gets or sets the device power saving mode.
+ /// Gets or sets the power saving mode idle.
/// </summary>
- public PowerDownMinutes PowerSavingMode { get; set; }
+ public PowerSavingModes PowerSavingModeIdle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the power saving mode power off.
+ /// </summary>
+ public PowerSavingModes PowerSavingModePowerOff { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PPCSettings"/> class.
/// </summary>
public PPCSettings()
{
- PowerSavingMode = PowerDownMinutes.Default;
+ PowerSavingModeIdle = PowerSavingModes.Default;
+ PowerSavingModePowerOff = PowerSavingModes.Maximum;
EmulatorMode = EmulatorMode.InMemory;
LubricationLevels = new List<RmlLubricationLevel>();
JobUploadStrategy = JobUploadStrategy.JobDescriptionFile;
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index 0e2a0e40c..a3c0cc389 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -614,10 +614,11 @@ namespace Tango.Integration.Operation
Task ResetCard(int cardID);
/// <summary>
- /// Sets the firmware device time to auto power down.
+ /// Sets the machine power saving mode.
/// </summary>
- /// <param name="minutes">Timeout Minutes.</param>
+ /// <param name="timeToIdleMinutes">The time to idle in minutes.</param>
+ /// <param name="timeToPowerDownMinutes">The time to power down in minutes.</param>
/// <returns></returns>
- Task SetPowerDownTime(int minutes);
+ Task SetPowerSavingMode(int timeToIdleMinutes,int timeToPowerDownMinutes);
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 527c063fb..870541394 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -4707,16 +4707,16 @@ namespace Tango.Integration.Operation
/// </summary>
/// <param name="minutes">Timeout Minutes.</param>
/// <returns></returns>
- public async Task SetPowerDownTime(int minutes)
+ public async Task SetPowerSavingMode(int timeToIdleMinutes, int timeToPowerDownMinutes)
{
try
{
- LogManager.Log($"Settings machine auto power down time to {minutes} minutes...");
- var r = await SendRequest<SetPowerDownTimeRequest, SetPowerDownTimeResponse>(new SetPowerDownTimeRequest() { TimeoutMinutes = minutes });
+ LogManager.Log($"Settings machine power saving mode to {timeToIdleMinutes},{timeToPowerDownMinutes} minutes...");
+ var r = await SendRequest<SetPowerDownTimeRequest, SetPowerDownTimeResponse>(new SetPowerDownTimeRequest() { TimeToPowerOffMinutes = timeToPowerDownMinutes });
}
catch (Exception ex)
{
- LogManager.Log(ex, $"Error setting down power down time to {minutes} minutes.");
+ LogManager.Log(ex, $"Error setting machine power saving mode.");
throw ex;
}
}
diff --git a/Software/Visual_Studio/Tango.PMR/MachineStatus/SetPowerDownTimeRequest.cs b/Software/Visual_Studio/Tango.PMR/MachineStatus/SetPowerDownTimeRequest.cs
index 6f645401f..adb9467c3 100644
--- a/Software/Visual_Studio/Tango.PMR/MachineStatus/SetPowerDownTimeRequest.cs
+++ b/Software/Visual_Studio/Tango.PMR/MachineStatus/SetPowerDownTimeRequest.cs
@@ -23,13 +23,14 @@ namespace Tango.PMR.MachineStatus {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Ch1TZXRQb3dlckRvd25UaW1lUmVxdWVzdC5wcm90bxIXVGFuZ28uUE1SLk1h",
- "Y2hpbmVTdGF0dXMiMQoXU2V0UG93ZXJEb3duVGltZVJlcXVlc3QSFgoOVGlt",
- "ZW91dE1pbnV0ZXMYASABKAVCIwohY29tLnR3aW5lLnRhbmdvLnBtci5tYWNo",
- "aW5lc3RhdHVzYgZwcm90bzM="));
+ "Y2hpbmVTdGF0dXMiUwoXU2V0UG93ZXJEb3duVGltZVJlcXVlc3QSGQoRVGlt",
+ "ZVRvSWRsZU1pbnV0ZXMYASABKAUSHQoVVGltZVRvUG93ZXJPZmZNaW51dGVz",
+ "GAIgASgFQiMKIWNvbS50d2luZS50YW5nby5wbXIubWFjaGluZXN0YXR1c2IG",
+ "cHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.MachineStatus.SetPowerDownTimeRequest), global::Tango.PMR.MachineStatus.SetPowerDownTimeRequest.Parser, new[]{ "TimeoutMinutes" }, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.MachineStatus.SetPowerDownTimeRequest), global::Tango.PMR.MachineStatus.SetPowerDownTimeRequest.Parser, new[]{ "TimeToIdleMinutes", "TimeToPowerOffMinutes" }, null, null, null)
}));
}
#endregion
@@ -60,7 +61,8 @@ namespace Tango.PMR.MachineStatus {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public SetPowerDownTimeRequest(SetPowerDownTimeRequest other) : this() {
- timeoutMinutes_ = other.timeoutMinutes_;
+ timeToIdleMinutes_ = other.timeToIdleMinutes_;
+ timeToPowerOffMinutes_ = other.timeToPowerOffMinutes_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -68,14 +70,25 @@ namespace Tango.PMR.MachineStatus {
return new SetPowerDownTimeRequest(this);
}
- /// <summary>Field number for the "TimeoutMinutes" field.</summary>
- public const int TimeoutMinutesFieldNumber = 1;
- private int timeoutMinutes_;
+ /// <summary>Field number for the "TimeToIdleMinutes" field.</summary>
+ public const int TimeToIdleMinutesFieldNumber = 1;
+ private int timeToIdleMinutes_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int TimeoutMinutes {
- get { return timeoutMinutes_; }
+ public int TimeToIdleMinutes {
+ get { return timeToIdleMinutes_; }
set {
- timeoutMinutes_ = value;
+ timeToIdleMinutes_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "TimeToPowerOffMinutes" field.</summary>
+ public const int TimeToPowerOffMinutesFieldNumber = 2;
+ private int timeToPowerOffMinutes_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int TimeToPowerOffMinutes {
+ get { return timeToPowerOffMinutes_; }
+ set {
+ timeToPowerOffMinutes_ = value;
}
}
@@ -92,14 +105,16 @@ namespace Tango.PMR.MachineStatus {
if (ReferenceEquals(other, this)) {
return true;
}
- if (TimeoutMinutes != other.TimeoutMinutes) return false;
+ if (TimeToIdleMinutes != other.TimeToIdleMinutes) return false;
+ if (TimeToPowerOffMinutes != other.TimeToPowerOffMinutes) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
- if (TimeoutMinutes != 0) hash ^= TimeoutMinutes.GetHashCode();
+ if (TimeToIdleMinutes != 0) hash ^= TimeToIdleMinutes.GetHashCode();
+ if (TimeToPowerOffMinutes != 0) hash ^= TimeToPowerOffMinutes.GetHashCode();
return hash;
}
@@ -110,17 +125,24 @@ namespace Tango.PMR.MachineStatus {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
- if (TimeoutMinutes != 0) {
+ if (TimeToIdleMinutes != 0) {
output.WriteRawTag(8);
- output.WriteInt32(TimeoutMinutes);
+ output.WriteInt32(TimeToIdleMinutes);
+ }
+ if (TimeToPowerOffMinutes != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(TimeToPowerOffMinutes);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
- if (TimeoutMinutes != 0) {
- size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeoutMinutes);
+ if (TimeToIdleMinutes != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeToIdleMinutes);
+ }
+ if (TimeToPowerOffMinutes != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeToPowerOffMinutes);
}
return size;
}
@@ -130,8 +152,11 @@ namespace Tango.PMR.MachineStatus {
if (other == null) {
return;
}
- if (other.TimeoutMinutes != 0) {
- TimeoutMinutes = other.TimeoutMinutes;
+ if (other.TimeToIdleMinutes != 0) {
+ TimeToIdleMinutes = other.TimeToIdleMinutes;
+ }
+ if (other.TimeToPowerOffMinutes != 0) {
+ TimeToPowerOffMinutes = other.TimeToPowerOffMinutes;
}
}
@@ -144,7 +169,11 @@ namespace Tango.PMR.MachineStatus {
input.SkipLastField();
break;
case 8: {
- TimeoutMinutes = input.ReadInt32();
+ TimeToIdleMinutes = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ TimeToPowerOffMinutes = input.ReadInt32();
break;
}
}