Skip to content

Commit

Permalink
Merge pull request #139 from SUPLA/develop
Browse files Browse the repository at this point in the history
v2.3.33
  • Loading branch information
przemyslawzygmunt authored Jan 10, 2021
2 parents 360e346 + 0348489 commit 074142b
Show file tree
Hide file tree
Showing 25 changed files with 1,935 additions and 523 deletions.
62 changes: 58 additions & 4 deletions SUPLA.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

24 changes: 17 additions & 7 deletions SUPLA/AddWizardVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
#define STEP_NONE 0
#define STEP_CHECK_REGISTRATION_ENABLED_TRY1 1
#define STEP_CHECK_REGISTRATION_ENABLED_TRY2 2
#define STEP_SUPERUSER_AUTHORIZATION 3
#define STEP_ENABLING_REGISTRATION 4
#define STEP_WIFI_AUTO_CONNECT 5
#define STEP_CONFIGURE 6
#define STEP_DONE 7
#define STEP_CHECK_REGISTRATION_ENABLED_TRY3 3
#define STEP_SUPERUSER_AUTHORIZATION 4
#define STEP_ENABLING_REGISTRATION 5
#define STEP_WIFI_AUTO_CONNECT 6
#define STEP_CONFIGURE 7
#define STEP_DONE 8

#define PAGE_STEP_1 1
#define PAGE_STEP_2 2
Expand Down Expand Up @@ -350,7 +351,9 @@ - (void)watchDogTimerFireMethod:(NSTimer *)timer {
switch(_step) {
case STEP_CHECK_REGISTRATION_ENABLED_TRY1:
case STEP_CHECK_REGISTRATION_ENABLED_TRY2:
timeout = 3;
case STEP_CHECK_REGISTRATION_ENABLED_TRY3:
// The connection may be restarting
timeout = 5;
break;
case STEP_ENABLING_REGISTRATION:
timeout = 5;
Expand Down Expand Up @@ -508,6 +511,10 @@ -(void) onWatchDogTimeout {
[[SAApp SuplaClient] getRegistrationEnabled];
break;
case STEP_CHECK_REGISTRATION_ENABLED_TRY2:
[self setStep:STEP_CHECK_REGISTRATION_ENABLED_TRY3];
[[SAApp SuplaClient] getRegistrationEnabled];
break;
case STEP_CHECK_REGISTRATION_ENABLED_TRY3:
[self showError:NSLocalizedString(@"Device registration availability information timeout!", NULL)];
break;
case STEP_ENABLING_REGISTRATION:
Expand Down Expand Up @@ -833,6 +840,7 @@ - (IBAction)nextTouchch:(id)sender {
if ( goNext ) {
[self savePrefs];
[self setStep:STEP_CHECK_REGISTRATION_ENABLED_TRY1];

[[SAApp SuplaClient] getRegistrationEnabled];
} else {
[self preloaderVisible:NO];
Expand Down Expand Up @@ -865,7 +873,9 @@ - (IBAction)cancelTouch:(id)sender {
[self.OpQueue cancelAllOperations];
[self savePrefs];
[[SAApp UI] showMainVC];
[[SAApp SuplaClient] reconnect];
//if (_pageId == PAGE_DONE) {
[[SAApp SuplaClient] reconnect];
//}
}


Expand Down
95 changes: 48 additions & 47 deletions SUPLA/Base.lproj/AddWizardVC.xib

Large diffs are not rendered by default.

332 changes: 332 additions & 0 deletions SUPLA/Base.lproj/SADiwCalibrationTool.xib

Large diffs are not rendered by default.

267 changes: 264 additions & 3 deletions SUPLA/Base.lproj/SAInfoVC.xib

Large diffs are not rendered by default.

65 changes: 41 additions & 24 deletions SUPLA/RGBWDetailView.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@
#import "SAClassHelper.h"
#import "SAInfoVC.h"
#import "SAVLCalibrationTool.h"
#import "SADiwCalibrationTool.h"

#define MIN_REMOTE_UPDATE_PERIOD 0.25
#define MIN_UPDATE_DELAY 3
#define DELAY_AUTO 0

#define ZAM_PRODID_DIW_01 2000

@implementation SARGBWDetailView {
int _brightness;
int _colorBrightness;
BOOL _varilight;
BOOL _zamel_diw_01;
BOOL isGroup;
UIColor *_color;
NSArray *_colorMarkers;
Expand All @@ -45,7 +49,7 @@ @implementation SARGBWDetailView {

NSDate *_moveEndTime;
NSDate *_remoteUpdateTime;
SAVLCalibrationTool *_vlCalibrationTool;
SADimmerCalibrationTool *_dimmerCalibrationTool;
}

-(void)detailViewInit {
Expand Down Expand Up @@ -228,9 +232,7 @@ -(void)showDimmer {
[self onPickerTypeTabTouch:_varilight ? self.tabSlider : self.tabWheel];
}

self.cbPicker.minBrightness = _varilight ? 1.0 : 0.0;

[self setExtraButtonsHidden:!_varilight];
[self setExtraButtonsHidden:!_varilight && !_zamel_diw_01];
[self setWheelSliderTabsHidden:NO];
self.tabRGB.selected = NO;
self.tabRGB.backgroundColor = [UIColor rgbwNormalTabColor];
Expand Down Expand Up @@ -258,9 +260,9 @@ -(void)updateView {

[super updateView];

if (_vlCalibrationTool != nil && !_vlCalibrationTool.isExitLocked) {
[_vlCalibrationTool dismiss];
_vlCalibrationTool = nil;
if (_dimmerCalibrationTool != nil && !_dimmerCalibrationTool.isExitLocked) {
[_dimmerCalibrationTool dismiss];
_dimmerCalibrationTool = nil;
}

if (isGroup) {
Expand Down Expand Up @@ -327,14 +329,23 @@ -(void)setChannelBase:(SAChannelBase *)channelBase {
_colorBrightnessMarkers = nil;
_colorMarkers = nil;
_varilight = false;
_zamel_diw_01 = false;
self.cbPicker.minBrightness = 0.0;

if (channelBase != nil
&& [channelBase isKindOfClass:[SAChannel class]]
&& ((SAChannel*)channelBase).manufacturer_id == SUPLA_MFR_DOYLETRATT
&& ((SAChannel*)channelBase).product_id == 1) {
_varilight = YES;
&& [channelBase isKindOfClass:[SAChannel class]] ) {
if (((SAChannel*)channelBase).manufacturer_id == SUPLA_MFR_DOYLETRATT
&& ((SAChannel*)channelBase).product_id == 1) {
_varilight = YES;
self.cbPicker.minBrightness = 1.0;
} else if (((SAChannel*)channelBase).manufacturer_id == SUPLA_MFR_ZAMEL) {
self.cbPicker.minBrightness = 1.0;
if (((SAChannel*)channelBase).product_id == ZAM_PRODID_DIW_01) {
_zamel_diw_01 = YES;
}
}
}

switch(channelBase.func) {
case SUPLA_CHANNELFNC_DIMMER:
self.cbPicker.colorWheelHidden = YES;
Expand All @@ -356,7 +367,7 @@ -(void)setChannelBase:(SAChannelBase *)channelBase {

if ( channelBase != nil
&& channelBase.isOnline == NO
&& (_vlCalibrationTool == nil || !_vlCalibrationTool.isExitLocked)) {
&& (_dimmerCalibrationTool == nil || !_dimmerCalibrationTool.isExitLocked)) {
[self.main_view detailShow:NO animated:NO];
return;
}
Expand Down Expand Up @@ -454,15 +465,21 @@ - (void)setPowerButtonOn:(BOOL)on {
self.cbPicker.powerButtonOn = on;
}
- (IBAction)onSettingsTouch:(id)sender {
if (_vlCalibrationTool == nil) {
_vlCalibrationTool = [SAVLCalibrationTool newInstance];
if (_dimmerCalibrationTool == nil) {
if (_varilight) {
_dimmerCalibrationTool = [SAVLCalibrationTool newInstance];
} else if (_zamel_diw_01) {
_dimmerCalibrationTool = [SADiwCalibrationTool newInstance];
}
}

if (_dimmerCalibrationTool != nil) {
[_dimmerCalibrationTool startConfiguration:self];
}

[_vlCalibrationTool startConfiguration:self];
}

- (IBAction)rgbInfoTouch:(id)sender {
[SAInfoVC showInformationWindowWithMessage:INFO_MESSAGE_VARILIGHT];
[SAInfoVC showInformationWindowWithMessage:INFO_MESSAGE_DIMMER];
}

- (IBAction)onPowerBtnTouch:(id)sender {
Expand All @@ -471,24 +488,24 @@ - (IBAction)onPowerBtnTouch:(id)sender {
}

-(BOOL)onMenubarBackButtonPressed {
if (_vlCalibrationTool && _vlCalibrationTool.superview) {
return [_vlCalibrationTool onMenubarBackButtonPressed];
if (_dimmerCalibrationTool && _dimmerCalibrationTool.superview) {
return [_dimmerCalibrationTool onMenubarBackButtonPressed];
}
return YES;
}

- (void)handlePan:(UIPanGestureRecognizer *)gr {
if (_vlCalibrationTool == nil || _vlCalibrationTool.superview == nil) {
if (_dimmerCalibrationTool == nil || _dimmerCalibrationTool.superview == nil) {
[super handlePan:gr];
}
}

-(void)detailWillHide {
[super detailWillHide];

if (_vlCalibrationTool != nil) {
[_vlCalibrationTool dismiss];
_vlCalibrationTool = nil;
if (_dimmerCalibrationTool != nil) {
[_dimmerCalibrationTool dismiss];
_dimmerCalibrationTool = nil;
}
}
@end
Binary file added SUPLA/Resources/Assets/Img/btnOK_disabled@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/btnOK_disabled@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/infinity@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/infinitywhite@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/p100@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/p100white@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SUPLA/Resources/Assets/Img/zamel_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions SUPLA/SADimmerCalibrationTool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright (C) AC SOFTWARE SP. Z O.O.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#import <UIKit/UIKit.h>
#import "DetailView.h"
#import "SARangeCalibrationWheel.h"
#import "SASuperuserAuthorizationDialog.h"

NS_ASSUME_NONNULL_BEGIN

@interface SADimmerCalibrationTool : UIView <UIGestureRecognizerDelegate, SASuperuserAuthorizationDialogDelegate>
@property (weak, nonatomic) IBOutlet UIButton *btnInfo;
@property (weak, nonatomic) IBOutlet UIButton *btnRestore;
@property (weak, nonatomic) IBOutlet UIButton *btnOK;
@property (weak, nonatomic) IBOutlet UIView *tabBgLedOn;
@property (weak, nonatomic) IBOutlet UIImageView *tabLedOn;
@property (weak, nonatomic) IBOutlet UIView *tabBgLedOff;
@property (weak, nonatomic) IBOutlet UIImageView *tabLedOff;
@property (weak, nonatomic) IBOutlet UIView *tabBgLedAlwaysOff;
@property (weak, nonatomic) IBOutlet UIImageView *tabLedAlwaysOff;

- (void)initGestureRecognizerForView:(UIView *)view action:(SEL)action;
- (IBAction)btnInfoTouch:(id)sender;
- (IBAction)btnRestoreTouch:(id)sender;
- (IBAction)btnOKTouch:(id)sender;

- (void) deviceCalCfgCommand:(int)command charValue:(nullable char*)charValue shortValue:(nullable short*)shortValue;
- (void) deviceCalCfgCommand:(int)command charValue:(char)charValue;
- (void) deviceCalCfgCommand:(int)command shortValue:(short)shortValue;
- (void) deviceCalCfgCommand:(int)command;
- (void) deviceCalCfgCommandWithDelay:(int)command;

-(void)startConfiguration:(SADetailView*)detailView;
-(void)setConfigurationStarted;
-(void)cfgToUIWithDelay:(BOOL)delay;
-(void)dismiss;
-(BOOL)isExitLocked;
-(BOOL)onMenubarBackButtonPressed;
-(BOOL)isConfigurationStarted;
-(void)showPreloaderWithText:(NSString *)text;

+(SADimmerCalibrationTool*)newInstance;
@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 074142b

Please sign in to comment.