From 723f284237ddb795ecd2daea72b27bf92617c75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E5=8F=91=E5=86=AC?= Date: Mon, 23 May 2022 18:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=A9=E5=BA=A6=E6=A0=A1=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XuanduoTempratueCorrectViewController.m | 34 +++++++++++-------- .../XuTo/XuanduoTempratureCorrectView.m | 3 +- .../XuTo/XuanduoTempratureCorrectView.xib | 24 +++++++------ 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m index 6e96934..8bd8ccd 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m @@ -142,7 +142,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; self.view.backgroundColor=COLOR_MIAN; XuanduoTempratureCorrectView*tempView=[XuanduoTempratureCorrectView viewFromXib]; - tempView.frame=CGRectMake(10, 10, 300, 150); + tempView.frame=CGRectMake(10, 100, 300, 150); tempView.centerX=self.view.centerX; tempView.layer.cornerRadius=10; @@ -167,7 +167,10 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; [self.view addSubview:label]; [self.tempView.cancelBtn addTarget:self action:@selector(cancelCorrect) forControlEvents:UIControlEventTouchUpInside]; - [self.tempView.textField becomeFirstResponder]; +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.35 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self.tempView.textField becomeFirstResponder]; +// }); + } @@ -181,7 +184,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; -(void)cancelCorrect { [self.tempView.textField resignFirstResponder]; - [self correctTempCorrectModel:NO]; + [self correctTempCorrectModel:YES]; } - (void)sure { [self.tempView.textField resignFirstResponder]; @@ -349,24 +352,25 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; readModel.functionCode=@"15"; readModel.massagelegth=@"18"; - NSString*deviation=@"01";//正校准 - if ([self.tempView.textField.text containsString:@"-"]) - { - deviation=@"02";//负向校准 - } - if (cancelCorrect) - { - deviation=@"00"; - } + NSString*pureString=[self.tempView.textField.text stringByReplacingOccurrencesOfString:@"-" withString:@""]; pureString=[pureString stringByReplacingOccurrencesOfString:@"+" withString:@""]; pureString=[pureString stringByReplacingOccurrencesOfString:@"℃" withString:@""]; - NSInteger delta= (NSInteger)(pureString.floatValue*10); + float delta= pureString.floatValue; - NSString*hex=[dataContorl leftAddZero:2 andStr:[dataContorl ToHex:delta]]; + float mac=[dataContorl hexToTen:self.tempCorrectModel.realTemp]; - NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@",readModel.description,@"0b",deviation,hex,@"00000000",@"0000"]; + //float TPlabel=mac/10+(mac%10)*0.1; + float temp = mac/10.0+delta; + + NSString*rightTemp =[dataContorl leftAddZero:4 andStr:[dataContorl ToHex:temp*10]]; + if (cancelCorrect) + { + rightTemp=@"0000"; + } + + NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@",readModel.description,@"0b",rightTemp,@"00000000",@"0000"]; NSData*readData=[dataContorl stringToHexData:readString]; [[Socketsingleton sharedInstance] soketWriteData:readData]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m index e8a380d..dab9c79 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m @@ -20,7 +20,8 @@ -(void)awakeFromNib { [super awakeFromNib]; - self.cancelBtn.titleLabel.font=[UIFont systemFontOfSize:15]; + self.cancelBtn.layer.masksToBounds=YES; + self.cancelBtn.layer.cornerRadius=8; self.correectTempLabel.layer.cornerRadius=8; } diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib index 8177932..7b64a98 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib @@ -27,22 +27,25 @@