From d08244d28cb6b84fc79047e06ee8eb9775cea6d6 Mon Sep 17 00:00:00 2001 From: Eric Yu Date: Sun, 16 Apr 2023 20:17:45 -0700 Subject: [PATCH] update readme --- .vscode/arduino.json | 6 +- .vscode/c_cpp_properties.json | 386 +++++++++++++++------------------- README.md | 14 +- make.bat | 5 + read_arduino.py | 1 + test.py | 16 +- ui.py | 2 +- 7 files changed, 193 insertions(+), 237 deletions(-) diff --git a/.vscode/arduino.json b/.vscode/arduino.json index bc51be1..f0b40bf 100644 --- a/.vscode/arduino.json +++ b/.vscode/arduino.json @@ -1,6 +1,6 @@ { - "configuration": "cpu=atmega328", - "board": "arduino:avr:nano", + "board": "arduino:mbed_nano:nanorp2040connect", "programmer": "avrisp", - "sketch": "nano_c_mk1\\nano_c_mk1.ino" + "sketch": "nano_c_mk1\\nano_c_mk1.ino", + "port": "COM9" } \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 9f7f211..8803549 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -3,51 +3,51 @@ "configurations": [ { "name": "Arduino", - "compilerPath": "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\bin\\avr-g++", + "compilerPath": "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\bin\\arm-none-eabi-g++", "compilerArgs": [ "-w", - "-std=gnu++11", - "-fpermissive", - "-fno-exceptions", - "-ffunction-sections", - "-fdata-sections", - "-fno-threadsafe-statics", - "-Wno-error=narrowing" + "-nostdlib" ], "intelliSenseMode": "gcc-x64", "includePath": [ - "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino", - "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\eightanaloginputs", + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\cores\\arduino", + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\variants\\NANO_RP2040_CONNECT", "C:\\Users\\yuhc2\\Documents\\Arduino\\libraries\\Adafruit_ADS1X15", "C:\\Users\\yuhc2\\Documents\\Arduino\\libraries\\Adafruit_BusIO", - "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src", - "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\SPI\\src", - "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include", - "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\lib\\gcc\\avr\\7.3.0\\include-fixed", - "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\avr\\include" + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\libraries\\Wire", + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\libraries\\SPI", + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\cores\\arduino\\api\\deprecated", + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\cores\\arduino\\api\\deprecated-avr-comp", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\arm-none-eabi\\include\\c++\\7.2.1", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\arm-none-eabi\\include\\c++\\7.2.1\\arm-none-eabi", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\arm-none-eabi\\include\\c++\\7.2.1\\backward", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\lib\\gcc\\arm-none-eabi\\7.2.1\\include", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\lib\\gcc\\arm-none-eabi\\7.2.1\\include-fixed", + "c:\\users\\yuhc2\\appdata\\local\\arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4\\arm-none-eabi\\include" ], "forcedInclude": [ - "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino\\Arduino.h" + "C:\\Users\\yuhc2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nano\\3.5.4\\cores\\arduino\\Arduino.h" ], "cStandard": "c11", "cppStandard": "c++11", "defines": [ - "F_CPU=16000000L", + "ARDUINO_ARCH_RP2040", "ARDUINO=10607", - "ARDUINO_AVR_NANO", - "ARDUINO_ARCH_AVR", - "__DBL_MIN_EXP__=(-125)", + "ARDUINO_NANO_RP2040_CONNECT", + "ARDUINO_ARCH_MBED_NANO", + "ARDUINO_ARCH_MBED", + "ARDUINO_LIBRARY_DISCOVERY_PHASE=0", + "__DBL_MIN_EXP__=(-1021)", "__HQ_FBIT__=15", + "__FLT32X_MAX_EXP__=1024", "__cpp_attributes=200809", - "__UINT_LEAST16_MAX__=0xffffU", + "__UINT_LEAST16_MAX__=0xffff", + "__ARM_SIZEOF_WCHAR_T=4", "__ATOMIC_ACQUIRE=2", "__SFRACT_IBIT__=0", - "__FLT_MIN__=1.17549435e-38F", + "__FLT_MIN__=1.1754943508222875e-38F", "__GCC_IEC_559_COMPLEX=0", - "__BUILTIN_AVR_SLEEP=1", - "__BUILTIN_AVR_COUNTLSULLK=1", "__cpp_aggregate_nsdmi=201304", - "__BUILTIN_AVR_COUNTLSULLR=1", "__UFRACT_MAX__=0XFFFFP-16UR", "__UINT_LEAST8_TYPE__=unsigned char", "__DQ_FBIT__=63", @@ -58,39 +58,38 @@ "__USQ_IBIT__=0", "__UINT8_MAX__=0xff", "__ACCUM_FBIT__=15", - "__WINT_MAX__=0x7fff", + "__WINT_MAX__=0xffffffffU", "__FLT32_MIN_EXP__=(-125)", "__cpp_static_assert=200410", "__USFRACT_FBIT__=8", "__ORDER_LITTLE_ENDIAN__=1234", - "__SIZE_MAX__=0xffffU", - "__WCHAR_MAX__=0x7fff", + "__SIZE_MAX__=0xffffffffU", + "__ARM_ARCH_ISA_ARM=1", + "__WCHAR_MAX__=0xffffffffU", "__LACCUM_IBIT__=32", - "__DBL_DENORM_MIN__=double(1.40129846e-45L)", + "__DBL_DENORM_MIN__=double(4.9406564584124654e-324L)", "__GCC_ATOMIC_CHAR_LOCK_FREE=1", "__GCC_IEC_559=0", + "__FLT32X_DECIMAL_DIG__=17", "__FLT_EVAL_METHOD__=0", - "__BUILTIN_AVR_LLKBITS=1", "__cpp_binary_literals=201304", - "__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-47LLK", + "__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LLK", + "__FLT64_DECIMAL_DIG__=17", "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1", - "__BUILTIN_AVR_HKBITS=1", - "__BUILTIN_AVR_BITSLLK=1", "__FRACT_FBIT__=15", - "__BUILTIN_AVR_BITSLLR=1", "__cpp_variadic_templates=200704", "__UINT_FAST64_MAX__=0xffffffffffffffffULL", - "__SIG_ATOMIC_TYPE__=char", - "__BUILTIN_AVR_UHKBITS=1", + "__SIG_ATOMIC_TYPE__=int", "__UACCUM_FBIT__=16", - "__DBL_MIN_10_EXP__=(-37)", + "__DBL_MIN_10_EXP__=(-307)", "__FINITE_MATH_ONLY__=0", + "__ARMEL__=1", "__cpp_variable_templates=201304", "__LFRACT_IBIT__=0", - "__GNUC_PATCHLEVEL__=0", + "__GNUC_PATCHLEVEL__=1", "__FLT32_HAS_DENORM__=1", "__LFRACT_MAX__=0X7FFFFFFFP-31LR", - "__UINT_FAST8_MAX__=0xff", + "__UINT_FAST8_MAX__=0xffffffffU", "__has_include(STR)=__has_include__(STR)", "__DEC64_MAX_EXP__=385", "__INT8_C(c)=c", @@ -98,7 +97,7 @@ "__UINT_LEAST64_MAX__=0xffffffffffffffffULL", "__SA_FBIT__=15", "__SHRT_MAX__=0x7fff", - "__LDBL_MAX__=3.40282347e+38L", + "__LDBL_MAX__=1.7976931348623157e+308L", "__FRACT_MAX__=0X7FFFP-15R", "__UFRACT_FBIT__=16", "__UFRACT_MIN__=0.0UR", @@ -106,29 +105,25 @@ "__GCC_ATOMIC_BOOL_LOCK_FREE=1", "__UINTMAX_TYPE__=long long unsigned int", "__LLFRACT_EPSILON__=0x1P-63LLR", - "__BUILTIN_AVR_DELAY_CYCLES=1", "__DEC32_EPSILON__=1E-6DF", "__FLT_EVAL_METHOD_TS_18661_3__=0", + "__CHAR_UNSIGNED__=1", "__UINT32_MAX__=0xffffffffUL", "__GXX_EXPERIMENTAL_CXX0X__=1", "__ULFRACT_MAX__=0XFFFFFFFFP-32ULR", - "__TA_IBIT__=16", - "__LDBL_MAX_EXP__=128", - "__WINT_MIN__=(-__WINT_MAX__ - 1)", + "__TA_IBIT__=64", + "__LDBL_MAX_EXP__=1024", + "__WINT_MIN__=0U", "__INT_LEAST16_WIDTH__=16", "__ULLFRACT_MIN__=0.0ULLR", "__SCHAR_MAX__=0x7f", - "__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)", + "__WCHAR_MIN__=0U", "__INT64_C(c)=c ## LL", - "__DBL_DIG__=6", + "__DBL_DIG__=15", "__GCC_ATOMIC_POINTER_LOCK_FREE=1", - "__AVR_HAVE_SPH__=1", - "__LLACCUM_MIN__=(-0X1P15LLK-0X1P15LLK)", - "__BUILTIN_AVR_KBITS=1", - "__BUILTIN_AVR_ABSK=1", - "__BUILTIN_AVR_ABSR=1", - "__SIZEOF_INT__=2", - "__SIZEOF_POINTER__=2", + "__LLACCUM_MIN__=(-0X1P31LLK-0X1P31LLK)", + "__SIZEOF_INT__=4", + "__SIZEOF_POINTER__=4", "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1", "__USACCUM_IBIT__=8", "__USER_LABEL_PREFIX__", @@ -138,144 +133,127 @@ "__HA_IBIT__=8", "__FLT32_DIG__=6", "__TQ_IBIT__=0", - "__FLT_EPSILON__=1.19209290e-7F", + "__FLT_EPSILON__=1.1920928955078125e-7F", + "__APCS_32__=1", "__GXX_WEAK__=1", "__SHRT_WIDTH__=16", "__USFRACT_IBIT__=0", - "__LDBL_MIN__=1.17549435e-38L", + "__LDBL_MIN__=2.2250738585072014e-308L", "__FRACT_MIN__=(-0.5R-0.5R)", - "__AVR_SFR_OFFSET__=0x20", "__DEC32_MAX__=9.999999E96DF", - "__cpp_threadsafe_static_init=200806", "__DA_IBIT__=32", + "__ARM_SIZEOF_MINIMAL_ENUM=1", + "__FLT32X_HAS_INFINITY__=1", "__INT32_MAX__=0x7fffffffL", "__UQQ_FBIT__=8", - "__INT_WIDTH__=16", + "__INT_WIDTH__=32", "__SIZEOF_LONG__=4", "__UACCUM_MAX__=0XFFFFFFFFP-16UK", - "__UINT16_C(c)=c ## U", - "__PTRDIFF_WIDTH__=16", - "__DECIMAL_DIG__=9", + "__UINT16_C(c)=c", + "__PTRDIFF_WIDTH__=32", + "__DECIMAL_DIG__=17", "__LFRACT_EPSILON__=0x1P-31LR", - "__AVR_2_BYTE_PC__=1", + "__FLT64_EPSILON__=2.2204460492503131e-16F64", "__ULFRACT_MIN__=0.0ULR", "__INTMAX_WIDTH__=64", + "__FLT64_MIN_EXP__=(-1021)", "__has_include_next(STR)=__has_include_next__(STR)", - "__BUILTIN_AVR_ULLRBITS=1", "__LDBL_HAS_QUIET_NAN__=1", "__ULACCUM_IBIT__=32", + "__FLT64_MANT_DIG__=53", "__UACCUM_EPSILON__=0x1P-16UK", - "__BUILTIN_AVR_SEI=1", "__GNUC__=7", - "__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-48ULLK", + "__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULLK", + "__GXX_RTTI=1", "__cpp_delegating_constructors=200604", "__HQ_IBIT__=0", - "__BUILTIN_AVR_SWAP=1", "__FLT_HAS_DENORM__=1", - "__SIZEOF_LONG_DOUBLE__=4", - "__BIGGEST_ALIGNMENT__=1", + "__SIZEOF_LONG_DOUBLE__=8", + "__BIGGEST_ALIGNMENT__=8", "__STDC_UTF_16__=1", - "__UINT24_MAX__=16777215UL", - "__BUILTIN_AVR_NOP=1", + "__FLT64_MAX_10_EXP__=308", "__GNUC_STDC_INLINE__=1", "__DQ_IBIT__=0", "__FLT32_HAS_INFINITY__=1", - "__DBL_MAX__=double(3.40282347e+38L)", + "__DBL_MAX__=double(1.7976931348623157e+308L)", "__ULFRACT_IBIT__=0", "__cpp_raw_strings=200710", - "__INT_FAST32_MAX__=0x7fffffffL", + "__INT_FAST32_MAX__=0x7fffffff", "__DBL_HAS_INFINITY__=1", "__INT64_MAX__=0x7fffffffffffffffLL", "__ACCUM_IBIT__=16", "__DEC32_MIN_EXP__=(-94)", - "__BUILTIN_AVR_UKBITS=1", - "__INTPTR_WIDTH__=16", - "__BUILTIN_AVR_FMULSU=1", + "__THUMB_INTERWORK__=1", + "__INTPTR_WIDTH__=32", "__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK", + "__FLT32X_HAS_DENORM__=1", "__INT_FAST16_TYPE__=int", "__LDBL_HAS_DENORM__=1", - "__BUILTIN_AVR_BITSK=1", - "__BUILTIN_AVR_BITSR=1", "__cplusplus=201402L", "__cpp_ref_qualifiers=200710", "__DEC128_MAX__=9.999999999999999999999999999999999E6144DL", "__INT_LEAST32_MAX__=0x7fffffffL", - "__USING_SJLJ_EXCEPTIONS__=1", + "__ARM_PCS=1", "__DEC32_MIN__=1E-95DF", "__ACCUM_MAX__=0X7FFFFFFFP-15K", "__DEPRECATED=1", "__cpp_rvalue_references=200610", - "__DBL_MAX_EXP__=128", + "__DBL_MAX_EXP__=1024", "__USACCUM_EPSILON__=0x1P-8UHK", - "__WCHAR_WIDTH__=16", - "__FLT32_MAX__=3.40282347e+38F32", + "__WCHAR_WIDTH__=32", + "__FLT32_MAX__=3.4028234663852886e+38F32", "__DEC128_EPSILON__=1E-33DL", "__SFRACT_MAX__=0X7FP-7HR", "__FRACT_IBIT__=0", - "__PTRDIFF_MAX__=0x7fff", + "__PTRDIFF_MAX__=0x7fffffff", "__UACCUM_MIN__=0.0UK", "__UACCUM_IBIT__=16", - "__BUILTIN_AVR_NOPS=1", - "__BUILTIN_AVR_WDR=1", "__FLT32_HAS_QUIET_NAN__=1", "__GNUG__=7", "__LONG_LONG_MAX__=0x7fffffffffffffffLL", - "__SIZEOF_SIZE_T__=2", + "__SIZEOF_SIZE_T__=4", "__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK", "__cpp_rvalue_reference=200610", "__cpp_nsdmi=200809", - "__SIZEOF_WINT_T__=2", + "__SIZEOF_WINT_T__=4", "__LONG_LONG_WIDTH__=64", "__cpp_initializer_lists=200806", "__FLT32_MAX_EXP__=128", "__SA_IBIT__=16", "__ULLACCUM_MIN__=0.0ULLK", - "__BUILTIN_AVR_ROUNDUHK=1", - "__BUILTIN_AVR_ROUNDUHR=1", "__cpp_hex_float=201603", "__GXX_ABI_VERSION=1011", - "__INT24_MAX__=8388607L", - "__UTA_FBIT__=48", + "__UTA_FBIT__=64", + "__SOFTFP__=1", "__FLT_MIN_EXP__=(-125)", "__USFRACT_MAX__=0XFFP-8UHR", "__UFRACT_IBIT__=0", - "__BUILTIN_AVR_ROUNDFX=1", - "__BUILTIN_AVR_ROUNDULK=1", - "__BUILTIN_AVR_ROUNDULR=1", "__cpp_lambdas=200907", - "__BUILTIN_AVR_COUNTLSLLK=1", - "__BUILTIN_AVR_COUNTLSLLR=1", - "__BUILTIN_AVR_ROUNDHK=1", "__INT_FAST64_TYPE__=long long int", - "__BUILTIN_AVR_ROUNDHR=1", - "__DBL_MIN__=double(1.17549435e-38L)", - "__BUILTIN_AVR_COUNTLSK=1", - "__BUILTIN_AVR_ROUNDLK=1", - "__BUILTIN_AVR_COUNTLSR=1", - "__BUILTIN_AVR_ROUNDLR=1", + "__FLT64_DENORM_MIN__=4.9406564584124654e-324F64", + "__DBL_MIN__=double(2.2250738585072014e-308L)", + "__FLT32X_EPSILON__=2.2204460492503131e-16F32x", "__LACCUM_MIN__=(-0X1P31LK-0X1P31LK)", - "__ULLACCUM_FBIT__=48", - "__BUILTIN_AVR_LKBITS=1", + "__ULLACCUM_FBIT__=32", + "__GXX_TYPEINFO_EQUALITY_INLINE=0", + "__FLT64_MIN_10_EXP__=(-307)", "__ULLFRACT_EPSILON__=0x1P-64ULLR", + "__USES_INITFINI__=1", "__DEC128_MIN__=1E-6143DL", "__REGISTER_PREFIX__", - "__UINT16_MAX__=0xffffU", + "__UINT16_MAX__=0xffff", "__DBL_HAS_DENORM__=1", - "__BUILTIN_AVR_ULKBITS=1", "__ACCUM_MIN__=(-0X1P15K-0X1P15K)", - "__AVR_ARCH__=2", "__SQ_IBIT__=0", - "__FLT32_MIN__=1.17549435e-38F32", + "__FLT32_MIN__=1.1754943508222875e-38F32", "__UINT8_TYPE__=unsigned char", - "__BUILTIN_AVR_ROUNDUK=1", - "__BUILTIN_AVR_ROUNDUR=1", "__UHA_FBIT__=8", "__NO_INLINE__=1", "__SFRACT_MIN__=(-0.5HR-0.5HR)", "__UTQ_FBIT__=128", "__FLT_MANT_DIG__=24", - "__LDBL_DECIMAL_DIG__=9", - "__VERSION__=\"7.3.0\"", + "__LDBL_DECIMAL_DIG__=17", + "__VERSION__=\"7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]\"", "__UINT64_C(c)=c ## ULL", "__ULLFRACT_FBIT__=64", "__cpp_unicode_characters=200704", @@ -283,35 +261,25 @@ "__ULACCUM_MIN__=0.0ULK", "__UDA_FBIT__=32", "__cpp_decltype_auto=201304", - "__LLACCUM_EPSILON__=0x1P-47LLK", + "__LLACCUM_EPSILON__=0x1P-31LLK", "__GCC_ATOMIC_INT_LOCK_FREE=1", "__FLT32_MANT_DIG__=24", - "__BUILTIN_AVR_BITSUHK=1", - "__BUILTIN_AVR_BITSUHR=1", "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", "__USFRACT_MIN__=0.0UHR", - "__BUILTIN_AVR_BITSULK=1", - "__ULLACCUM_IBIT__=16", - "__BUILTIN_AVR_BITSULR=1", + "__ULLACCUM_IBIT__=32", "__UQQ_IBIT__=0", - "__BUILTIN_AVR_LLRBITS=1", "__SCHAR_WIDTH__=8", - "__BUILTIN_AVR_BITSULLK=1", - "__BUILTIN_AVR_BITSULLR=1", "__INT32_C(c)=c ## L", "__DEC64_EPSILON__=1E-15DD", "__ORDER_PDP_ENDIAN__=3412", "__DEC128_MIN_EXP__=(-6142)", "__UHQ_FBIT__=16", - "__LLACCUM_FBIT__=47", + "__LLACCUM_FBIT__=31", "__FLT32_MAX_10_EXP__=38", - "__BUILTIN_AVR_ROUNDULLK=1", - "__BUILTIN_AVR_ROUNDULLR=1", - "__INT_FAST32_TYPE__=long int", - "__BUILTIN_AVR_HRBITS=1", - "__UINT_LEAST16_TYPE__=unsigned int", - "__BUILTIN_AVR_UHRBITS=1", + "__INT_FAST32_TYPE__=int", + "__UINT_LEAST16_TYPE__=short unsigned int", "__INT16_MAX__=0x7fff", + "__cpp_rtti=199711", "__SIZE_TYPE__=unsigned int", "__UINT64_MAX__=0xffffffffffffffffULL", "__UDQ_FBIT__=64", @@ -321,24 +289,22 @@ "__ULFRACT_EPSILON__=0x1P-32ULR", "__LLFRACT_FBIT__=63", "__FLT_RADIX__=2", - "__INT_LEAST16_TYPE__=int", - "__BUILTIN_AVR_ABSFX=1", - "__LDBL_EPSILON__=1.19209290e-7L", + "__INT_LEAST16_TYPE__=short int", + "__LDBL_EPSILON__=2.2204460492503131e-16L", "__UINTMAX_C(c)=c ## ULL", - "__INT24_MIN__=(-__INT24_MAX__-1)", "__SACCUM_MAX__=0X7FFFP-7HK", - "__BUILTIN_AVR_ABSHR=1", - "__SIG_ATOMIC_MAX__=0x7f", + "__SIG_ATOMIC_MAX__=0x7fffffff", "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1", "__cpp_sized_deallocation=201309", - "__SIZEOF_PTRDIFF_T__=2", - "__AVR=1", - "__BUILTIN_AVR_ABSLK=1", - "__BUILTIN_AVR_ABSLR=1", + "__VFP_FP__=1", + "__SIZEOF_PTRDIFF_T__=4", + "__FLT32X_MANT_DIG__=53", "__LACCUM_EPSILON__=0x1P-31LK", + "__FLT32X_MIN_EXP__=(-1021)", "__DEC32_SUBNORMAL_MIN__=0.000001E-95DF", - "__INT_FAST16_MAX__=0x7fff", - "__UINT_FAST32_MAX__=0xffffffffUL", + "__INT_FAST16_MAX__=0x7fffffff", + "__FLT64_DIG__=15", + "__UINT_FAST32_MAX__=0xffffffffU", "__UINT_LEAST64_TYPE__=long long unsigned int", "__USACCUM_MAX__=0XFFFFP-8UHK", "__SFRACT_EPSILON__=0x1P-7HR", @@ -351,46 +317,46 @@ "__USA_FBIT__=16", "__UINT_FAST16_TYPE__=unsigned int", "__DEC64_MAX__=9.999999999999999E384DD", + "__ARM_32BIT_STATE=1", "__INT_FAST32_WIDTH__=32", - "__BUILTIN_AVR_RBITS=1", - "__CHAR16_TYPE__=unsigned int", + "__CHAR16_TYPE__=short unsigned int", "__PRAGMA_REDEFINE_EXTNAME=1", - "__SIZE_WIDTH__=16", + "__SIZE_WIDTH__=32", "__INT_LEAST16_MAX__=0x7fff", "__DEC64_MANT_DIG__=16", "__UINT_LEAST32_MAX__=0xffffffffUL", "__SACCUM_FBIT__=7", - "__FLT32_DENORM_MIN__=1.40129846e-45F32", + "__FLT32_DENORM_MIN__=1.4012984643248171e-45F32", "__GCC_ATOMIC_LONG_LOCK_FREE=1", - "__SIG_ATOMIC_WIDTH__=8", + "__SIG_ATOMIC_WIDTH__=32", "__INT_LEAST64_TYPE__=long long int", - "__INT16_TYPE__=int", + "__INT16_TYPE__=short int", "__INT_LEAST8_TYPE__=signed char", "__SQ_FBIT__=31", "__DEC32_MAX_EXP__=97", - "__INT_FAST8_MAX__=0x7f", - "__INTPTR_MAX__=0x7fff", + "__ARM_ARCH_ISA_THUMB=1", + "__INT_FAST8_MAX__=0x7fffffff", + "__ARM_ARCH=4", + "__INTPTR_MAX__=0x7fffffff", "__QQ_FBIT__=7", "__cpp_range_based_for=200907", - "__UTA_IBIT__=16", - "__AVR_ERRATA_SKIP__=1", + "__UTA_IBIT__=64", + "__FLT64_HAS_QUIET_NAN__=1", "__FLT32_MIN_10_EXP__=(-37)", - "__LDBL_MANT_DIG__=24", + "__EXCEPTIONS=1", + "__LDBL_MANT_DIG__=53", "__SFRACT_FBIT__=7", "__SACCUM_MIN__=(-0X1P7HK-0X1P7HK)", "__DBL_HAS_QUIET_NAN__=1", + "__FLT64_HAS_INFINITY__=1", "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", - "AVR=1", - "__BUILTIN_AVR_FMULS=1", "__cpp_return_type_deduction=201304", "__INTPTR_TYPE__=int", - "__UINT16_TYPE__=unsigned int", - "__WCHAR_TYPE__=int", + "__UINT16_TYPE__=short unsigned int", + "__WCHAR_TYPE__=unsigned int", "__SIZEOF_FLOAT__=4", - "__AVR__=1", - "__BUILTIN_AVR_INSERT_BITS=1", "__USQ_FBIT__=32", - "__UINTPTR_MAX__=0xffffU", + "__UINTPTR_MAX__=0xffffffffU", "__INT_FAST64_WIDTH__=64", "__DEC64_MIN_EXP__=(-382)", "__cpp_decltype=200707", @@ -399,141 +365,125 @@ "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", "__FLT_DIG__=6", "__UINT_FAST64_TYPE__=long long unsigned int", - "__BUILTIN_AVR_BITSHK=1", - "__BUILTIN_AVR_BITSHR=1", - "__INT_MAX__=0x7fff", + "__INT_MAX__=0x7fffffff", "__LACCUM_FBIT__=31", "__USACCUM_MIN__=0.0UHK", "__UHA_IBIT__=8", "__INT64_TYPE__=long long int", - "__BUILTIN_AVR_BITSLK=1", - "__BUILTIN_AVR_BITSLR=1", "__FLT_MAX_EXP__=128", "__UTQ_IBIT__=0", - "__DBL_MANT_DIG__=24", + "__DBL_MANT_DIG__=53", "__cpp_inheriting_constructors=201511", - "__BUILTIN_AVR_ULLKBITS=1", "__INT_LEAST64_MAX__=0x7fffffffffffffffLL", "__DEC64_MIN__=1E-383DD", - "__WINT_TYPE__=int", + "__WINT_TYPE__=unsigned int", "__UINT_LEAST32_TYPE__=long unsigned int", "__SIZEOF_SHORT__=2", "__ULLFRACT_IBIT__=0", - "__LDBL_MIN_EXP__=(-125)", + "__LDBL_MIN_EXP__=(-1021)", + "__arm__=1", + "__FLT64_MAX__=1.7976931348623157e+308F64", "__UDA_IBIT__=32", - "__WINT_WIDTH__=16", + "__WINT_WIDTH__=32", "__INT_LEAST8_MAX__=0x7f", + "__FLT32X_MAX_10_EXP__=308", "__LFRACT_FBIT__=31", - "__LDBL_MAX_10_EXP__=38", + "__WCHAR_UNSIGNED__=1", + "__LDBL_MAX_10_EXP__=308", "__ATOMIC_RELAXED=0", - "__DBL_EPSILON__=double(1.19209290e-7L)", - "__BUILTIN_AVR_BITSUK=1", - "__BUILTIN_AVR_BITSUR=1", + "__DBL_EPSILON__=double(2.2204460492503131e-16L)", "__UINT8_C(c)=c", + "__FLT64_MAX_EXP__=1024", "__INT_LEAST32_TYPE__=long int", - "__BUILTIN_AVR_URBITS=1", - "__SIZEOF_WCHAR_T__=2", + "__SIZEOF_WCHAR_T__=4", "__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR", "__TQ_FBIT__=127", - "__INT_FAST8_TYPE__=signed char", - "__ULLACCUM_EPSILON__=0x1P-48ULLK", - "__BUILTIN_AVR_ROUNDK=1", - "__BUILTIN_AVR_ROUNDR=1", + "__INT_FAST8_TYPE__=int", + "__ULLACCUM_EPSILON__=0x1P-32ULLK", "__UHQ_IBIT__=0", - "__LLACCUM_IBIT__=16", - "__FLT32_EPSILON__=1.19209290e-7F32", - "__DBL_DECIMAL_DIG__=9", + "__ARM_FEATURE_COPROC=1", + "__LLACCUM_IBIT__=32", + "__FLT64_HAS_DENORM__=1", + "__FLT32_EPSILON__=1.1920928955078125e-7F32", + "__DBL_DECIMAL_DIG__=17", "__STDC_UTF_32__=1", - "__INT_FAST8_WIDTH__=8", + "__INT_FAST8_WIDTH__=32", "__DEC_EVAL_METHOD__=2", - "__TA_FBIT__=47", + "__FLT32X_MAX__=1.7976931348623157e+308F32x", + "__TA_FBIT__=63", "__UDQ_IBIT__=0", "__ORDER_BIG_ENDIAN__=4321", "__cpp_runtime_arrays=198712", - "__WITH_AVRLIBC__=1", "__UINT64_TYPE__=long long unsigned int", "__ACCUM_EPSILON__=0x1P-15K", "__UINT32_C(c)=c ## UL", - "__BUILTIN_AVR_COUNTLSUHK=1", "__INTMAX_MAX__=0x7fffffffffffffffLL", "__cpp_alias_templates=200704", - "__BUILTIN_AVR_COUNTLSUHR=1", "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__FLT_DENORM_MIN__=1.40129846e-45F", + "__FLT_DENORM_MIN__=1.4012984643248171e-45F", "__LLFRACT_IBIT__=0", "__INT8_MAX__=0x7f", "__LONG_WIDTH__=32", - "__UINT_FAST32_TYPE__=long unsigned int", + "__UINT_FAST32_TYPE__=unsigned int", "__CHAR32_TYPE__=long unsigned int", - "__BUILTIN_AVR_COUNTLSULK=1", - "__BUILTIN_AVR_COUNTLSULR=1", - "__FLT_MAX__=3.40282347e+38F", + "__FLT_MAX__=3.4028234663852886e+38F", "__cpp_constexpr=201304", "__USACCUM_FBIT__=8", - "__BUILTIN_AVR_COUNTLSFX=1", "__INT32_TYPE__=long int", - "__SIZEOF_DOUBLE__=4", + "__SIZEOF_DOUBLE__=8", + "__cpp_exceptions=199711", "__FLT_MIN_10_EXP__=(-37)", "__UFRACT_EPSILON__=0x1P-16UR", + "__FLT64_MIN__=2.2250738585072014e-308F64", "__INT_LEAST32_WIDTH__=32", - "__BUILTIN_AVR_COUNTLSHK=1", - "__BUILTIN_AVR_COUNTLSHR=1", "__INTMAX_TYPE__=long long int", - "__BUILTIN_AVR_ABSLLK=1", - "__BUILTIN_AVR_ABSLLR=1", "__DEC128_MAX_EXP__=6145", - "__AVR_HAVE_16BIT_SP__=1", + "__FLT32X_HAS_QUIET_NAN__=1", "__ATOMIC_CONSUME=1", - "__GNUC_MINOR__=3", - "__INT_FAST16_WIDTH__=16", + "__GNUC_MINOR__=2", + "__INT_FAST16_WIDTH__=32", "__UINTMAX_MAX__=0xffffffffffffffffULL", "__DEC32_MANT_DIG__=7", + "__FLT32X_DENORM_MIN__=4.9406564584124654e-324F32x", "__HA_FBIT__=7", - "__BUILTIN_AVR_COUNTLSLK=1", - "__BUILTIN_AVR_COUNTLSLR=1", - "__BUILTIN_AVR_CLI=1", - "__DBL_MAX_10_EXP__=38", - "__LDBL_DENORM_MIN__=1.40129846e-45L", + "__DBL_MAX_10_EXP__=308", + "__LDBL_DENORM_MIN__=4.9406564584124654e-324L", "__INT16_C(c)=c", "__cpp_generic_lambdas=201304", "__STDC__=1", + "__ARM_ARCH_4T__=1", + "__FLT32X_DIG__=15", "__PTRDIFF_TYPE__=int", "__LLFRACT_MIN__=(-0.5LLR-0.5LLR)", - "__BUILTIN_AVR_LRBITS=1", "__ATOMIC_SEQ_CST=5", "__DA_FBIT__=31", "__UINT32_TYPE__=long unsigned int", - "__BUILTIN_AVR_ROUNDLLK=1", + "__FLT32X_MIN_10_EXP__=(-307)", "__UINTPTR_TYPE__=unsigned int", - "__BUILTIN_AVR_ROUNDLLR=1", "__USA_IBIT__=16", - "__BUILTIN_AVR_ULRBITS=1", "__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD", + "__ARM_EABI__=1", "__DEC128_MANT_DIG__=34", - "__LDBL_MIN_10_EXP__=(-37)", - "__BUILTIN_AVR_COUNTLSUK=1", - "__BUILTIN_AVR_COUNTLSUR=1", + "__LDBL_MIN_10_EXP__=(-307)", "__SIZEOF_LONG_LONG__=8", "__ULACCUM_EPSILON__=0x1P-32ULK", "__cpp_user_defined_literals=200809", "__SACCUM_IBIT__=8", "__GCC_ATOMIC_LLONG_LOCK_FREE=1", - "__LDBL_DIG__=6", + "__FLT32X_MIN__=2.2250738585072014e-308F32x", + "__LDBL_DIG__=15", "__FLT_DECIMAL_DIG__=9", - "__UINT_FAST16_MAX__=0xffffU", + "__UINT_FAST16_MAX__=0xffffffffU", "__GCC_ATOMIC_SHORT_LOCK_FREE=1", - "__BUILTIN_AVR_ABSHK=1", - "__BUILTIN_AVR_FLASH_SEGMENT=1", "__INT_LEAST64_WIDTH__=64", "__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR", - "__UINT_FAST8_TYPE__=unsigned char", + "__UINT_FAST8_TYPE__=unsigned int", "__USFRACT_EPSILON__=0x1P-8UHR", "__ULACCUM_FBIT__=32", "__QQ_IBIT__=0", "__cpp_init_captures=201304", "__ATOMIC_ACQ_REL=4", "__ATOMIC_RELEASE=3", - "__BUILTIN_AVR_FMUL=1", "USBCON" ] } diff --git a/README.md b/README.md index 5cc30fc..1631d42 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Read the resistance of a voltage divider using Arduino boards - Code Runner (for VSCode only) - [vscode-arduino](https://github.com/microsoft/vscode-arduino) (for VSCode only) -- wxFormBuilder +- [wxFormBuilder](https://github.com/wxFormBuilder/wxFormBuilder) (if you want to change anything for ui) - [Arduino IDE](https://makeabilitylab.github.io/physcomp/arduino/arduino-ide.html) ## How to use @@ -45,14 +45,13 @@ as it is generated from wxFormBuilder from `sealammonia.fbp`, which could be mod the main program will generate `settings.json` which saves all required parameters needed to calculate and graph and save the sensor's values. It also creates a .csv file under `RecordedData` directory to save all recorded+calculated data. `read_arduino.py` read raw data from Arduino board and convert it to the correct resistance, which could be plotted out -using `serial_plotter.py`. To make your own executable, use `PyInstaller` using this command in your python environment: -`pyinstaller build.spec`. +using `serial_plotter.py`. To make your own executable, simply use the psydo makefile in a terminal with command `make exe` to build one. Alternatively, use `PyInstaller` by using this command in your python environment: `pyinstaller build.spec`. -ATTENTION MAC USER: currently the software cannot correctly functional on mac (especially arm-based ones). You might need to consider to use it on a windows VM or using parallel desktop +ATTENTION MAC + LINUX USER: currently the software cannot correctly functional on unix (especially arm-based ones). You might need to consider to use it on a windows VM or using parallel desktop. The school's engineering department has one, you can learn more [here](https://www.engr.washington.edu/mycoe/computing/studentresources/coevdi.html). ## Issues -- Newer hardware will require 3.3V. ~~Currently can only use 5V as input voltage.~~ May need to change the algorithm in `read_arduino.py`. +- ~~Newer hardware will require 3.3V. Currently can only use 5V as input voltage. May need to change the algorithm in `read_arduino.py`.~~ The new software now allows user to change this - axis window size is not correct - on PyInstaller, windows misdetected our executable as a virus (seems resolved) - change the scale on Y-axis so that graph looks smoother @@ -61,7 +60,7 @@ ATTENTION MAC USER: currently the software cannot correctly functional on mac (e ## Todos: - [ ] Fix Issues -- [ ] Add an option to change the font size of the graph +- [X] Add an option to change the font size of the graph - [ ] Add different shapes to different lines one the graph in addition to differen colors - [ ] programically to stablize the graph (change the y-scale of the graph to make the less dramatic) - [ ] (not urgent) make it runnable on Mac @@ -76,9 +75,6 @@ ATTENTION MAC USER: currently the software cannot correctly functional on mac (e - [X] Write random values to simulate a sensor if no sensor available (this feature might be removed in the future) - [X] Advanced option menu in the UI to allow user to make more adjustments - [X] Add resolution option in the UI to allow interchange between arduino (10bit) and esp32 (12 bits) (Not Applicable in new hardware) - -- ~~ Possibly adding new module to support ESP32~~ - - [ ] Support for non-Windows platforms (and maybe mobile) - [ ] Make it into one executable - [ ] Possibly adding new module to support Arduino MEGA and older firmwares (Need testing) diff --git a/make.bat b/make.bat index c4113b2..26cf67a 100644 --- a/make.bat +++ b/make.bat @@ -5,12 +5,17 @@ for %%I in ("%cd%") do set env=%%~nxI if "%~1"=="build" GOTO build if "%~1"=="clean" GOTO clean if "%~1"=="run" GOTO run +if "%~1"=="exe" GOTO exe :build python -m venv %env% %env%\Scripts\activate && pip install -r requirements.txt GOTO run +:exe + %env%\Scripts\pyinstaller build.spec +GOTO End + :clean del *.json 2>nul rmdir /s /q RecordedData 2>nul diff --git a/read_arduino.py b/read_arduino.py index 58d4dea..643f7c5 100644 --- a/read_arduino.py +++ b/read_arduino.py @@ -96,6 +96,7 @@ def read(): # if we decided to switch back to analogRead(), replace this line of comment to the algorithm to something like the commented line below # dat_sel = np.take(dat_list, sensor_ports) * v_in / resolution # take only the nonzero indices, and truncated to two decimal places to "filter" out some hardware errors + # below line is the actual formula for the voltage divider from voltage to resistance. See report's formula for detail r_arr = np.take(refRes, sensor_ports) * (v_in / dat_sel - 1) # *2 <-- change with actual formula for ammonia concentration # created a new array to convert resistance values to sci notation r_arr2 = np.empty(len(r_arr), dtype=object) diff --git a/test.py b/test.py index f31d1cf..909e621 100644 --- a/test.py +++ b/test.py @@ -52,7 +52,10 @@ def main(): def gen_settings(resistors, input_voltage, port, filename, window_size, font_size, delay): """ - export all inputs from main() to a .json file + export all inputs from main() to a .json file. We have everything stored in a .json file instead of having the program to call + the values from the UI directly because 1. we dont have to import the ui.py all the time (so we can freely change ui.py to whatever + else and only need to modify this one) and 2. we can have other program to access one variable from the ui at the same time. This adds + flexibility to the program. We parameterize all the value for the same reason. :param resistors: list of reference resistances of the sensors :param input_voltage: Vin of the voltage divider :param bits: ADC resolution for the board. Usualy 12-bits for ESP32 (and 10 bits for Arduino Mega) @@ -80,7 +83,8 @@ def gen_settings(resistors, input_voltage, port, filename, window_size, font_siz def run(e): """ - run the read_arduino.py and Serial Plotter in parallel + run the read_arduino.py and Serial Plotter in parallel, but the plotter is in the main thread and other one can be in a separate thread, since + matplot's FuncAnimation doesn't like to not be in the main thread (Big L for them..) """ global ani, t1 # the variables to call the plotter and the read_arduino.py, we want them to get tossed around between functions and even programs main() @@ -103,7 +107,6 @@ def run(e): if __name__ == '__main__': console_title = 'Program Crashed! Here are the details' # this is there for now to redirect any errors - # Acknowledgement: https://stackoverflow.com/a/27694505 if sys.platform.startswith('win'): # On Windows calling this function is necessary. @@ -115,15 +118,16 @@ if __name__ == '__main__': console = wx.PyOnDemandOutputWindow(console_title) console.SetParent(frame) sys.stderr = console - # instrad of print(), use sys.stdout.write() to print to allow us redirect the output elsewhere. TODO: may not work in the exe - sys.stdout.write("this is an alpha version of the design. This debug terminal will be gone on official release\n") + # instrad of print(), add something similar `sys.stdout = console` (without the two `) to print to allow us redirect the output elsewhere + # BUT it only redirects the print() in this program, not the print() on other modules, like read_arduino.py + print("this is an Beta version of the design. This debug terminal will be gone on official release\n") ports = [f"{comport.device}: {comport.description}" for comport in serial.tools.list_ports.comports()] # get all available ports frame.dev_list.AppendItems(ports) frame.SetTitle("SeeDatResistance - Beta 0.1.2") frame.btLaunch.Bind(wx.EVT_BUTTON, run) if os.path.isfile("settings.json"): try: - sys.stdout.write("Found existing settings.json, auto-fill previous inputs!\n") + print("Found existing settings.json, auto-fill previous inputs!\n") settings = json.load(open('settings.json', 'r')) frame.r_ref_1.SetValue(str(settings["refRes"][0])) frame.r_ref_2.SetValue(str(settings["refRes"][1])) diff --git a/ui.py b/ui.py index f9e0419..c11817b 100644 --- a/ui.py +++ b/ui.py @@ -87,7 +87,7 @@ class Frame ( wx.Frame ): self.sizer_prompt.Wrap( -1 ) gbSizer8.Add( self.sizer_prompt, wx.GBPosition( 1, 0 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 ) - self.m_textCtrl26 = wx.TextCtrl( v_entre.GetStaticBox(), wx.ID_ANY, u"50", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_textCtrl26 = wx.TextCtrl( v_entre.GetStaticBox(), wx.ID_ANY, u"10", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_textCtrl26.SetToolTipString( u"Window size for the plot window. If want infinite/maximum size, type 0" ) gbSizer8.Add( self.m_textCtrl26, wx.GBPosition( 1, 1 ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.TOP|wx.RIGHT|wx.LEFT, 5 )