Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mqshaw documentation changes #34

Merged
merged 5 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SmartTally Server/MyTallyServer Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ This server has been written using Python 3, you can download the latest Python

---
### Revision History
**2021-05-11** : First release
**2021-05-11** : First release<br>
**2021-05-17** : Minor documentation fix
30 changes: 2 additions & 28 deletions libraries/M5Atom/utility/MPU6886.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void MPU6886::getTempAdc(int16_t *t){



//!俯仰,航向,横滚:pitch,yaw,roll,指三维空间中飞行器的旋转状态。(Refers to the rotation state of the aircraft in three-dimensional space. Pitch, heading, roll)
//!俯仰,航向,横滚:pitch,yaw,roll,指三维空间中飞行器的旋转状态。
void MPU6886::getAhrsData(float *pitch,float *roll,float *yaw){

float accX = 0;
Expand All @@ -146,32 +146,6 @@ void MPU6886::getAhrsData(float *pitch,float *roll,float *yaw){

}

void MPU6886::getAttitude(double *pitch, double *roll)
{
float accX = 0;
float accY = 0;
float accZ = 0;

float gyroX = 0;
float gyroY = 0;
float gyroZ = 0;

getGyroData(&gyroX, &gyroY, &gyroZ);
getAccelData(&accX, &accY, &accZ);

if ((accX < 1) && (accX > -1))
{
*pitch = asin(-accX) * 57.295;
}
if (accZ != 0)
{
*roll = atan(accY / accZ) * 57.295;
}

( *pitch ) = _alpha * ( *pitch ) + (1 - _alpha) * _last_theta;
( *roll ) = _alpha * ( *roll ) + (1 - _alpha) * _last_phi;
}

void MPU6886::getGres(){

switch (Gyscale)
Expand Down Expand Up @@ -218,7 +192,7 @@ void MPU6886::getAres(){

void MPU6886::SetGyroFsr(Gscale scale)
{
//return IIC_Write_Byte(MPU_GYRO_CFG_REG,scale<<3);//设置陀螺仪满量程范围 (Set the full scale range of the gyroscope)
//return IIC_Write_Byte(MPU_GYRO_CFG_REG,scale<<3);//设置陀螺仪满量程范围
unsigned char regdata;
regdata = (scale<<3);
I2C_Write_NBytes(MPU6886_ADDRESS, MPU6886_GYRO_CONFIG, 1, &regdata);
Expand Down
21 changes: 12 additions & 9 deletions libraries/libraries_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ So, I modified the following files to correct this oversight (and tweak a few ot
* `M5Atom.h`
* `utility/LED_DisPlay.h`
* `utility/LED_DisPlay.cpp`
* `utility/MPU6886.cpp`

To get the STAC sketch to compile, you'll have to replace the files provided by M5Stack with these modified versions. Or, in the STAC sketch, replace every call to `M5.dis.fillpix();` with your own routine.

Expand All @@ -17,20 +18,21 @@ But even if you do that, you'll still have to rename the `LED_DisPlay.h` and `LE
To use the modified libraries:

1. Navigate to your Arduino M5Atom libraries directory.
I'm not certain where this is kept on all platforms or where it was placed during your install. Searching for a folder named M5Atom should turn it up.<br><br>On macOS the default location is:<br>
`/Users/*YOUR_USER_NAME*/Documents/Arduino/libraries/M5Atom`<br><br>Inside that folder:
I'm not certain where this is kept on all platforms or where it was placed during your install. Searching for a folder named M5Atom should turn it up.<br><br>On macOS the default location is:<br>
`/Users/*YOUR_USER_NAME*/Documents/Arduino/libraries/M5Atom`<br><br>On Windows the default location is:<br>
`C:\Users\*YOUR_USER_NAME*\Documents\Arduino\libraries\M5Atom`<br><br>Inside that folder:

1. Rename the file `M5Atom.h` to something like `M5Atom.h.orig`
1. Copy the modified `M5Atom.h` file from this repository into the `Arduino/libraries/M5Atom` folder.
1. Open the `utility` folder that is inside the `Arduino/libraries/M5Atom` folder.
1. Rename the file `LED_DisPlay.h` to something like `LED_DisPlay.h.orig`
1. Rename the file `LED_DisPlay.cpp` to something like `LED_Display.cpp.orig`
1. From the `utility` folder in this repository, copy the modified `LED_Display.h` and `LED_Display.cpp` files into the `Arduino/libraries/M5Atom/utility` folder.
1. Rename the file `MPU6886.cpp` to something like `MPU6886.cpp.orig`
1. From the `utility` folder in this repository, copy the modified `LED_Display.h`, `LED_Display.cpp` and `MPU6886.cpp` files into the `Arduino/libraries/M5Atom/utility` folder.

&mdash; Note &mdash;<br>You will have to repeat these steps whenever M5Stack updates their <br>M5Atom libraries as their new version will overwrite these modified files.|
:---:

---
<br>

## Improved Preferences Library
After doing a deep dive into the Espressif ESP 32 IDF NVS storage methods and comparing their documentation to the Arduino ESP32 library, I modified the *Preferences.cpp* file to ensure changes made to the NVS when using certain Arduino *Preferences* function calls were committed to NVS. Those changes are documented in the modified *Preferences.h* file here.
Expand All @@ -39,11 +41,13 @@ While not essential for the STAC sketch to compile, I do believe these modified

### To use this library
1. Navigate to your Arduino ESP32 folder.<br>
I'm not certain where this is kept on all platforms or where it was placed during your install. Searching for a file named *Preferences.cpp* should turn it up.<br><br>On macOS the default location is:<br><br>
`/Users/*YOUR_USER_NAME*/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Preferences/src`
I'm not certain where this is kept on all platforms or where it was placed during your install. Searching for a file named *Preferences.cpp* should turn it up.<br><br>On macOS the default location is:<br>
`/Users/*YOUR_USER_NAME*/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Preferences/src`<br><br>On Windows the default location is:<br>
`C:\Users\*YOUR_USER_NAME*\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\Preferences\src`<br>

|&mdash; Note &mdash;<br>As newer versions of the ESP32 Arduino libraries are released,the location will change to reflect the version number of those libraries.<br>Thus, in the path above, you may need to replace *1.0.6* with the current version number.|
:--:
<br>

Inside the *src* folder:

Expand All @@ -52,7 +56,6 @@ Inside the *src* folder:

&mdash; Note &mdash;<br>You will have to repeat these steps whenever the Arduino ESP32 <br>libraries are updated as the new version will overwrite this modified file.|
:--:

<br>
A request has been submitted to the fantastic Arduino ESP32 team to incorporate these changes into the official release.

---