led improvement & bump build

master
esterTion 2020-03-03 11:10:27 +08:00
parent 6861777cf6
commit be2f1d9add
3 changed files with 33 additions and 22 deletions

View File

@ -334,7 +334,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = K9CP5766XY;
INFOPLIST_FILE = "Brokenithm-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@ -342,7 +342,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.estertion.brokenithm;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -357,7 +357,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = K9CP5766XY;
INFOPLIST_FILE = "Brokenithm-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@ -365,7 +365,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.estertion.brokenithm;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -17,11 +17,11 @@
</PostActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1968E72024086C2100784829"
@ -67,8 +67,7 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1968E72024086C2100784829"
@ -76,7 +75,7 @@
BlueprintName = "Brokenithm-iOS"
ReferencedContainer = "container:Brokenithm-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -34,8 +34,13 @@
self.airIOView = [[UIView alloc] initWithFrame:CGRectMake(0, offsetY, screenWidth, screenHeight*0.4)];
offsetY += screenHeight*0.4;
self.sliderIOView = [[UIView alloc] initWithFrame:CGRectMake(0, offsetY, screenWidth, sliderHeight)];
self.airIOView.layer.borderWidth = 1.0f;
self.airIOView.layer.borderColor = [UIColor whiteColor].CGColor;
self.sliderIOView.layer.borderWidth = 1.0f;
self.sliderIOView.layer.borderColor = [UIColor whiteColor].CGColor;
[self.view addSubview:self.airIOView];
[self.view addSubview:self.sliderIOView];
self.ledBackground = [CAGradientLayer layer];
self.ledBackground.frame = CGRectMake(0, 0, screenWidth, sliderHeight);
[self.sliderIOView.layer addSublayer:self.ledBackground];
@ -43,21 +48,26 @@
self.ledBackground.endPoint = CGPointMake(0,0);
{
float pointOffset = 0;
NSMutableArray *locations = [NSMutableArray arrayWithCapacity:33];
for (int i=0; i<33; i++) {
NSNumber *loc = [NSNumber numberWithFloat:pointOffset];
locations[i] = loc;
pointOffset += 1.0/32;
float gapSmall = 1.0/16/8, gapBig = 1.0/16*6/8;
NSMutableArray *locations = [NSMutableArray arrayWithCapacity:49];
for (int i=0,off=-1; i<16; i++) {
locations[++off] = [NSNumber numberWithFloat:pointOffset];
pointOffset += gapSmall;
locations[++off] = [NSNumber numberWithFloat:pointOffset];
pointOffset += gapBig;
locations[++off] = [NSNumber numberWithFloat:pointOffset];
pointOffset += gapSmall;
}
locations[48] = @1;
self.ledBackground.locations = locations;
}
struct CGColor *whiteColor = [UIColor whiteColor].CGColor;
struct CGColor *gridBorderColor = [UIColor colorWithWhite:1.0 alpha:0.2].CGColor;
float airOffset=0, airHeight = screenHeight*0.4/6;
for (int i=0;i<6;i++) {
UIView *airInput = [[UIView alloc] initWithFrame:CGRectMake(0, airOffset, screenWidth, airHeight)];
airInput.layer.borderWidth = 1.0f;
airInput.layer.borderColor = whiteColor;
airInput.layer.borderColor = gridBorderColor;
airOffset += airHeight;
[self.airIOView addSubview:airInput];
}
@ -66,7 +76,7 @@
for (int i=0;i<16;i++) {
UIView *sliderInput = [[UIView alloc] initWithFrame:CGRectMake(sliderOffset, 0, sliderWidth, sliderHeight)];
sliderInput.layer.borderWidth = 1.0f;
sliderInput.layer.borderColor = whiteColor;
sliderInput.layer.borderColor = gridBorderColor;
sliderOffset += sliderWidth;
[self.sliderIOView addSubview:sliderInput];
}
@ -76,7 +86,7 @@
NSLog(@"server created");
dispatch_async(dispatch_get_main_queue(), ^(){
char ledDataChar[32*3] = {0,254,254,0,254,254,0,254,254,0,0,0,254,254,254,254,254,254,254,254,254,0,0,0,10,10,10,10,10,10,10,10,10,0,0,0,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,0,0,0,0,254,0,0,254,0,0,254,0,0,254,0,0,254,0,0,0,0,0,254,0,0,254,0,0,254,0,0,254,0,0,254,0,0,0};
char ledDataChar[32*3] = {0,254,254,254,254,254,0,254,254,0,0,0,254,254,254,254,254,254,254,254,254,0,0,0,10,10,10,10,10,10,10,10,10,0,0,0,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,254,128,0,0,0,0,0,254,0,0,254,0,0,254,0,0,254,0,0,254,0,0,0,0,0,254,0,0,254,0,0,254,0,0,254,0,0,254,0,0,0};
NSData *ledData = [NSData dataWithBytes:ledDataChar length:32*3];
[self updateLed:ledData];
NSLog(@"displayed demo led");
@ -88,13 +98,15 @@
NSMutableArray *colorArr = [NSMutableArray arrayWithCapacity:33];
colorArr[0] = (__bridge id)([UIColor colorWithWhite:0 alpha:0].CGColor);
uint8_t *rgb = (uint8_t*)rgbData.bytes;
for (int i=0; i<32; i++) {
for (int i=0, off=0; i<32; i++) {
float r = rgb[i*3+1], g = rgb[i*3+2], b = rgb[i*3];
r /= 255.0;
g /= 255.0;
b /= 255.0;
UIColor *color = [UIColor colorWithRed:r green:g blue:b alpha:1];
colorArr[i+1] = (__bridge id)color.CGColor;
colorArr[++off] = (__bridge id)color.CGColor;
off += (i+1)&1;
colorArr[off] = (__bridge id)color.CGColor;
}
self.ledBackground.colors = colorArr;
[self.ledBackground setNeedsDisplay];