bug修改

This commit is contained in:
祝发冬 2022-06-14 20:16:05 +08:00
parent fe7aebacc7
commit d1e7d0c047
5 changed files with 109 additions and 32 deletions

View File

@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) IBOutlet UILabel *openTilmeLabel;
@property (weak, nonatomic) IBOutlet UILabel *closeTimeLabel;
@property (nonatomic,weak) id model;
@property (weak, nonatomic) IBOutlet UIButton *switchBtn;
@end
NS_ASSUME_NONNULL_END

View File

@ -28,7 +28,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="关闭00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xa5-yA-Py3">
<rect key="frame" x="195" y="12" width="120" height="20"/>
<rect key="frame" x="112" y="12" width="120" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="baf-Mm-MPz"/>
<constraint firstAttribute="height" constant="20" id="jHz-du-9rA"/>
@ -37,11 +37,22 @@
<color key="textColor" red="0.34901960780000002" green="0.34901960780000002" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x3i-Y3-Wrg">
<rect key="frame" x="252" y="12" width="40" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="Ro0-SQ-dRf"/>
<constraint firstAttribute="height" constant="20" id="lE1-Db-IpS"/>
</constraints>
<state key="normal" image="Switch-Off.png"/>
<state key="selected" image="Switch-On.png"/>
</button>
</subviews>
<constraints>
<constraint firstItem="V4x-oE-ip3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="1Qt-gz-Pid"/>
<constraint firstAttribute="trailing" secondItem="x3i-Y3-Wrg" secondAttribute="trailing" constant="28" id="8Cu-wz-Hqn"/>
<constraint firstItem="x3i-Y3-Wrg" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="U7B-wg-Zpz"/>
<constraint firstItem="V4x-oE-ip3" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="5" id="b8c-bF-gws"/>
<constraint firstAttribute="trailing" secondItem="xa5-yA-Py3" secondAttribute="trailing" constant="5" id="hSU-AU-WOF"/>
<constraint firstItem="xa5-yA-Py3" firstAttribute="trailing" secondItem="x3i-Y3-Wrg" secondAttribute="leading" constant="-20" id="hSU-AU-WOF"/>
<constraint firstItem="xa5-yA-Py3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="uTU-0b-0nR"/>
</constraints>
</tableViewCellContentView>
@ -49,8 +60,13 @@
<connections>
<outlet property="closeTimeLabel" destination="xa5-yA-Py3" id="ZmC-St-v4q"/>
<outlet property="openTilmeLabel" destination="V4x-oE-ip3" id="Lul-LQ-8N8"/>
<outlet property="switchBtn" destination="x3i-Y3-Wrg" id="gYH-pO-i7K"/>
</connections>
<point key="canvasLocation" x="139" y="64"/>
</tableViewCell>
</objects>
<resources>
<image name="Switch-Off.png" width="60" height="30"/>
<image name="Switch-On.png" width="60" height="30"/>
</resources>
</document>

View File

@ -161,7 +161,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
label.textColor=[UIColor whiteColor];
label.font=[UIFont systemFontOfSize:12];
label.numberOfLines=0;
label.text=@"温度校准值需在+-5℃以内超过+-5℃请更换水温抬头更换探头后需点击取消校准按钮清除上一次温度校准的误差值";
label.text=@"温度校准值需在±5℃以内超过±5℃请更换水温抬头更换探头后需点击取消校准按钮清除上一次温度校准的误差值";
CGSize size= [label.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:(NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName: label.font} context:NULL].size;
label.frame=CGRectMake((self.view.frame.size.width-size.width)/2.0, CGRectGetMaxY(tempView.frame)+100, size.width, size.height);
[self.view addSubview:label];
@ -199,7 +199,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
// NSArray*array=@[@"+",@"-",@".",@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@""];
// if (![array containsObject:string])
// {
// [self.view makeToast:@"请输入+-或数字"];
// [self.view makeToast:@"请输入±或数字"];
// return NO;
// }
return YES;
@ -299,6 +299,10 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
{
prefix=@"-";
}
if ([deltatempString isEqualToString:@"0.0"])
{
prefix=@"";
}
NSString *corrTemp = [NSString stringWithFormat:@"%.1f℃",[tempModel.deviation isEqualToString:@"02"]?(temp-deltatemp):(temp+deltatemp)];
self.tempView.deltaLabel.text=[NSString stringWithFormat:@"校准值%@%@",prefix,deltatempString];
@ -371,6 +375,9 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
if (ABS(detectTemp-delta)>=5&&!cancelCorrect)
{
[self.view makeToast:@"校准超过5℃请更换探头!"];
self.tempView.textField.text=[NSString stringWithFormat:@"%.1f℃",detectTemp];
[self.tempView.textField becomeFirstResponder];
return;
}

View File

@ -57,11 +57,11 @@
<constraint firstAttribute="height" constant="1" id="9xP-a6-ibF"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="校准值" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UAM-uW-zwv" userLabel="deltaLabel">
<rect key="frame" x="97" y="79.5" width="50" height="20"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="校准值" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UAM-uW-zwv" userLabel="deltaLabel">
<rect key="frame" x="72" y="79.5" width="100" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="scj-ny-6pE"/>
<constraint firstAttribute="width" constant="50" id="tvn-he-WQh"/>
<constraint firstAttribute="width" constant="100" id="tvn-he-WQh"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>

View File

@ -277,8 +277,10 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
BOOL havePlus = [dataArr containsObject:plusflag];
{
CycleTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:cycleTimerflag forIndexPath:indexPath];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]];
[cell.switchBtn setImage:[UIImage imageNamed:@"graybtn_big.png"] forState:UIControlStateNormal];
[cell.switchBtn setImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
[cell.switchBtn addTarget:self action:@selector(cycleModeAction:) forControlEvents:UIControlEventTouchUpInside];
cell.model=_cycleModel;
if([_cycleModel isKindOfClass:[XuanduoCycleModel class]])
{
@ -288,6 +290,14 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if ([_cycleModel.openTime isEqualToString:@"000000"]&&[_cycleModel.closeTime isEqualToString:@"000000"])
{
cell.switchBtn.selected=NO;
}
else
{
cell.switchBtn.selected=YES;
}
}
else
@ -598,26 +608,20 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
timerModel.isOn = @"01";
}
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
readModel.selectorNumber=self.lightNumber;
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
NSData*selctorData=[dataContorl stringToHexData:selectorString];
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
// [_indicatorView startAnimating];
readModel.selectorNumber = timerModel.selectorNumber;
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
NSLog(@"read str = %@",readString);
NSData*readData=[dataContorl stringToHexData:readString];
[[Socketsingleton sharedInstance] soketWriteData:readData];
if (self.timerType==3)
{
[self readAllDayRecoveryMode];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.35 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self readTimer];
if (self.timerType==3)
{
[self readAllDayRecoveryMode];
}
});
}
else if ([group isKindOfClass: [XuanduoCycleModel class] ])
{
@ -656,11 +660,60 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
}
}
- (void)cycleModeAction:(UIButton *)btn
{
if ([_cycleModel.openTime isEqualToString:@"000000"]&&[_cycleModel.closeTime isEqualToString:@"000000"])
{
[self.view makeToast:@"请设置时间"];
[self addCycleTimer:nil];
}
else//0
{
btn.selected=NO;
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
timerModel.sendmacId =self.currentdevice.macAddress;
timerModel.resavemacId = self.currentdevice.macAddress;
timerModel.crc16str=@"0000";
timerModel.isOn = @"01";
timerModel.selectorNumber=self.lightNumber;
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",@"000000",@"000000"];
[_mydatepicView removeFromSuperview];
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
NSInteger index = _selectSection ;
if (index < _titieArr.count) {
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]];
BOOL havePlus = NO;
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.selectorTime,timerModel.crc16str];
NSData*selctorData=[dataContorl stringToHexData:selectorString];
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
[_indicatorView startAnimating];
NSLog(@"hexString%@",selectorString);
NSLog(@"result%@",_mydatepicView.resultString);
readModel.selectorNumber = timerModel.selectorNumber;
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
NSData*readData=[dataContorl stringToHexData:readString];
[[Socketsingleton sharedInstance] soketWriteData:readData];
}
}
}
//
- (void)allDayModesSwitchAction:(UIButton *)btn {
void(^switchModeBlock)(void)=^(void){
btn.selected=!btn.selected;
// btn.selected=!btn.selected;
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
timerModel.sendmacId =self.currentdevice.macAddress;
timerModel.resavemacId = self.currentdevice.macAddress;
@ -668,7 +721,7 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
timerModel.selectorNumber=self.lightNumber;
timerModel.groupNumber=@"00";
timerModel.selectorTime=@"00000000";
if (!btn.selected) {
if (btn.selected) {
timerModel.isOn = @"00";
}else {
timerModel.isOn = @"01";
@ -677,8 +730,11 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
NSData*selctorData=[dataContorl stringToHexData:selectorString];
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
[self readAllDayRecoveryMode];
[self readTimer];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.35 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self readAllDayRecoveryMode];
[self readTimer];
});
};
UIAlertController*alert=[UIAlertController alertControllerWithTitle:@"提示" message:@"确认开启全天自恢复模式吗?开启此模式后当手动关闭该设备时10分钟后该设备将自动打开" preferredStyle:UIAlertControllerStyleAlert];
@ -934,10 +990,7 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
NSString *startTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString,_mydatepicView.endString,_mydatepicView.startSecondString];
NSString *endTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString1,_mydatepicView.endString1,_mydatepicView.endSecondString];
_mydatepicView.resultString=nil;
if([startTime isEqualToString:endTime]){
[self showTitle:@"" messsage:@"开始时间不能等于结束时间"];
return;
}
if([startTime isEqualToString:@"00:00:00"]||[endTime isEqualToString:@"00:00:00"]){
[self showTitle:@"" messsage:@"不能为0"];
return;