2017年8月24日 星期四

Building BetaFlight

Building BetaFlight

@UBUNTU/WIN10-BASH


Toolchain
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded
sudo apt-get install build-essential   /// for gcc if needed

SSH Key
ssh-keygen -t rsa -b 4096 -C "youraccount@git.hub"
cat ~/.ssh/id_rsa.pub
ssh-add ~/.ssh/id_rsa

GitHub new ssh key

Make
sudo apt-get install git   /// if needed
git clone git@github.com:betaflight/betaflight.git
cd betaflight
sudo make TARGET=NAZE


Update
git reset --hard
git pull
sudo make clean TARGET=NAZE


2017年7月17日 星期一

iOS App 上架駁回


由於是藍牙產品,App 需要連線才能動作,所以審核員也會要求你將硬體寄送過去給 Apple

底下是遭駁回的理由…

Guideline 2.1 - Information Needed

Thank you for your resubmission. We have started the review of your app, but we are not able to continue because we need the associated hardware to fully assess your app features.

Next Steps

To help us proceed with the review of your app, please send the necessary hardware/accessory to the address below.

NOTE: Please include your app name and app ID in the shipment; failure to provide this information can delay the review process.

Additionally, it may take several business days for us to receive the hardware once it has been delivered to Apple.

Apple, Inc.
1 Infinite Loop, M/S: 124-2APP
Cupertino, CA 95014
USA


解決方法…

先嘗式拍攝一段完整的DEMO影片回覆看看。
(後續:已審核通過)



2017年7月13日 星期四

iOS App 發佈出現錯誤-ERROR ITMS-90086


iOS App 發佈出現底下錯誤…
ERROR ITMS-90086: "Missing 64-bit support. iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK or later. We recommend using the default "Standard Architectures" build setting for "Architectures" in Xcode, to build a single binary with both 32-bit and 64-bit support." 

試了很久才總算 OK(上架真麻煩),但仍不知真正原因所在,記錄一下過程,應該多少有幫助…

有使用 CocoaPods 的話檢查一下專案(包含自己的及Pods的) signing 及 target 設定是否有錯,並記得 pod update 一下
檢查一下 Architectures 是否有錯,建議使用 Standard architectures
檢查一下 Valid Architectures 是否有錯,需包含 arm64
試試看 Bulid Settings 中 Enable bitcode 設為 No 是否有效


另外 iOS 10 以後,存取使用者私密資料 privacy-sensitive data 都要加上 usage description string,使用藍牙之類的週邊裝置也要加上相應的,不能留空白。

2017年6月5日 星期一

nRF51 Development Kit 開發環境

nRF51 Development Kit

開發環境安裝…

安裝 Keil 5

Keil - Pack Installer / Update

安裝 Device Family Pack
https://developer.nordicsemi.com/nRF5_SDK/
e.g. NordicSemiconductor.nRF_DeviceFamilyPack.8.11.1.pack

安裝 CMSIS pack
https://github.com/ARM-software/CMSIS/releases
e.g. ARM.CMSIS.4.5.0.pack

Keil 選單 project/manage/select software packs


2017年5月5日 星期五

Bluetooth GPS Tracer

一個簡單有趣的 GPS 應用,可以拿來用在尋機…

結合現成的三種模組 GPS Module、HC12 RF Module、HC-05 Bluetooth Module 再加上簡單的 App 解 MNEA GPS 格式,就能實現遠距 GPS 追蹤,類似防丟器的概念,但即時距離可達 1 公里。

Combine "CRIUS GPS Module"、"HC12 - Long Range RF Wireless SERIAL Module" and "HC-05 Bluetooth Module",make remote location trace with 433mhz RF and Bluetooth comunication

App...
https://play.google.com/store/apps/details?id=com.longfellowchen.bluetoothgpstracer

系統架構 - System Architecture…
GPS--[UART]-->HC12-->~~[RF433MHZ]~~-->HC12-->HC-05-->~~[BT2.4G]-->SmartPhone

硬體線路 - Hardware circuit...
基本上只是把模組 UART 線路全串在一起…

Remote device...
GPS-TX ---------------->HC12-RX
GPS-RX ---------------->HC12-TX (option)

Local device
HC05-TX ---------------->HC12-RX(option)
HC05-RX ---------------->HC12-TX

All Module..
VCC ----------------> +5V
GND ----------------> GND

注意事項…
*All module should set the same baud-rate (default is 9600)
*HC12 Module can set transmit power to what you want. (see it's documents)


2017年4月15日 星期六

Convert NMEA format data to latitude and longitude for GMap Latlng


Reference...
http://aprs.gids.nl/nmea/

Format...
$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh
1    = UTC of position fix
2    = Data status (V=navigation receiver warning)
3    = Latitude of fix
4    = N or S
5    = Longitude of fix
6    = E or W
7    = Speed over ground in knots
8    = Track made good in degrees True
9    = UT date
10   = Magnetic variation degrees (Easterly var. subtracts from true course)
11   = E or W
12   = Checksum

Formula...
Latitude / Longitude = ddmm.mmmm = dd + (mm.mmmm/60) (* -1 for W and S)

Java code...
String str = "$GPRMC,182807.036,A,3731.9404,N,10601.6986,W,0.078542,40.74,050107,,*20"
if( str.startsWith( "$GPRMC" ) )
{
    String[] tags = str.split(",");
    if( tags[2].equals("A") ) {
        String lotdd = tags[3].substring( 0, tags[3].indexOf(".") - 2 );
        String lotmm = tags[3].substring( tags[3].indexOf(".") -2 );
        float lot = Float.valueOf( lotdd ) + Float.valueOf( lotmm )/60;
        if( tags[4].equals("S") )
            lot = -lot;
        String lngdd = tags[5].substring( 0, tags[5].indexOf(".") - 2 );
        String lngmm = tags[5].substring( tags[5].indexOf(".") -2 );
        float lng = Float.valueOf( lngdd ) + Float.valueOf( lngmm )/60;
        if( tags[6].equals("W") )
            lng = -lng;
        LatLng pos = new LatLng( lot, lng );
    } else {
        // Invalid $GPRMC
    }
}

2017年3月26日 星期日

python 透過 google smtp server 發信的方法

python code‧‧‧

import smtplib
    to = 'where@gmail.com'
    server = "smtp.gmail.com"
    #port = 465 # ssl
    port = 587 # tls
    gmail_user = 'youraccount@gmail.com'
    gmail_pwd = 'yourpassword or application password'
    #smtpserver = smtplib.SMTP_SSL(server, long(port)) # ssl
    smtpserver = smtplib.SMTP(server, long(port)) # tls
    smtpserver.ehlo()
    smtpserver.starttls() # tls
    smtpserver.login(gmail_user, gmail_pwd)
    header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:test \n'
    print header
    msg = header + '\n this is test \n\n'
    smtpserver.sendmail(gmail_user, to, msg)
    print 'done!'
    smtpserver.quit()

*如果你有使用兩階段驗證,必須先到 google 個人設定頁,增加應用程式密碼,smtp 才會驗證通過…
    https://myaccount.google.com/apppasswords

VirtualBox 空間減肥

sdelete64 -z c: VBoxManage  modifymedium  disk  "/Users/fellow/VirtualBox VMs/Win10/Win10.vdi"  --compact *.vdi 路徑可以在 VirtualBox 儲...