From: acezhao Date: Thu, 14 Mar 2019 12:14:56 +0000 (+0800) Subject: .... X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=368130d2630f6a4713d2871d214dcc49663f6701;p=acecode.git .... --- diff --git a/arduino/src/AceVest.h b/arduino/src/AceVest.h index feb826d..5554816 100644 --- a/arduino/src/AceVest.h +++ b/arduino/src/AceVest.h @@ -9,6 +9,7 @@ #pragma once #include +#include #if defined(__GNUC__) && defined(__AVR__) # define ACEVEST_FONT_SECTION(name) ACEVEST_SECTION(".progmem." name) @@ -28,6 +29,6 @@ extern const uint8_t font_acevest[] ACEVEST_FONT_SECTION("font_acevest"); typedef struct { - const char *name; - const char *pwd; + String ssid; + String pwd; } WiFiItem_t; diff --git a/learn/doc/mac_bash_profile b/learn/doc/mac_bash_profile index 3b0562a..b34e642 100644 --- a/learn/doc/mac_bash_profile +++ b/learn/doc/mac_bash_profile @@ -5,6 +5,7 @@ HISTCONTROL=ignoreboth export PATH=/usr/local/sbin:$PATH export PATH=$HOME/.local/bin:$PATH export PATH=$PATH:$HOME/workspace/esp/xtensa-esp32-elf/bin +export PATH=$PATH:$HOME/workspace/esp/xtensa-lx106-elf/bin export GOBIN=$HOME/.local/bin export IDF_PATH=$HOME/workspace/esp/esp-idf export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ @@ -22,3 +23,12 @@ alias egrep='egrep --color' alias msf='msfconsole' alias cdw='cd ~/workspace/' export PATH="/usr/local/opt/ncurses/bin:$PATH" + + +export GREP_OPTIONS="--exclude-dir=\.svn" + + +# export LC_ALL LANG 解决ssh登录服务器,服务器报这个错 +# -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory +export LC_ALL=zh_CN.UTF-8 +export LANG=zh_CN.UTF-8 diff --git a/tools/game/kerbal_orbit.go b/tools/game/kerbal_orbit.go new file mode 100644 index 0000000..4e4d924 --- /dev/null +++ b/tools/game/kerbal_orbit.go @@ -0,0 +1,70 @@ +/* + * ------------------------------------------------------------------------ + * File Name: kerbal_orbit.go + * Author: Zhao Yanbai + * 2019-03-14 17:35:44 星期四 CST + * Description: none + * ------------------------------------------------------------------------ + */ +package main +import ( + "fmt" + "math" + "flag" +) + +var G = 6.67408E-11 + +type AstronomicalObject struct { + mass float64 + radius float64 +} + +var MassMap = map[string] AstronomicalObject { + "Moho" : { 2.5263314E21, 250000 }, + "Eve" : { 1.2243980E23, 700000 }, + "Gilly" : { 1.2420363E17, 13000 }, + "Kerbin" : { 5.2915158E22, 600000 }, + "Mun" : { 9.7599066E20, 200000 }, + "Minmus" : { 2.6457580E19, 60000 }, + "Duna" : { 4.5154270E21, 320000 }, + "Ike" : { 2.7821615E20, 130000 }, + "Dres" : { 3.2190937E20, 138000 }, + "Jool" : { 4.2332127E24, 6000000 }, + "Laythe" : { 2.9397311E22, 500000 }, + "Vall" : { 3.1087655E21, 300000 }, + "Tylo" : { 4.2332127E22, 600000 }, + "Bop" : { 3.7261090E19, 65000 }, + "Eeloo" : { 1.1149224E21, 210000 }, +} + +func main() { + defer fmt.Println("Program Exited...") + + var Cycle float64 + var CelestialName string + flag.Float64Var(&Cycle, "c", 0.0, "orbital cicle") + flag.StringVar(&CelestialName, "n", "", "celestial name") + + flag.Parse() + + fmt.Println(CelestialName) + + if CelestialName == "" || Cycle <= 0.0 { + flag.Usage(); + return + } + + o, ok := MassMap[CelestialName] + if !ok { + fmt.Printf("not valid celestial name\n"); + return + } + + M := o.mass + + T := Cycle + a := math.Pow(G*M*T*T/(4*math.Pi*math.Pi),1/3.0) + + fmt.Printf("%10.0f %10.0f\n", a, a-o.radius) +} diff --git a/tools/game/ksp_planet_transfer_calculator.go b/tools/game/ksp_planet_transfer_calculator.go index a65cc0b..bc4a105 100644 --- a/tools/game/ksp_planet_transfer_calculator.go +++ b/tools/game/ksp_planet_transfer_calculator.go @@ -87,8 +87,8 @@ func main() { // ===> (1/Td)*Tt*Pi + PhaseAngle = Pi // ===> PhaseAngle = Pi - Tt*Pi/Td - aos := objects["Kerbin"] aod := objects["Eve"] + aos := objects["Duna"] if aos.parent != aod.parent || aos.parent == "" || aod.parent == "" { fmt.Println("invalid astronomical object"); return