Navigation Menu

Skip to content

Commit

Permalink
1.fix the problem that the electronic compass Mecompass is hung on th…
Browse files Browse the repository at this point in the history
…e Orion mainboard 7 or 8 ports and communication will be hung dead.

2.fix the problem that the function getPointFast() in MeHumitureSensor.cpp does not normally output the value.
3.fix the problem that compile smartservo_test.ino firmware error report using the arduino1.6.5 environment with mBlock V3.4.12.
4.remove MeSuperVariable.cpp/MeSuperVariable.h.
5.fix the problem that ultrasonic module can only measure the maximum range of 375cm,and the maximum range of normal requirements is 400cm.
  • Loading branch information
MrHezhisheng committed Sep 2, 2019
1 parent b7b9738 commit 3a0e66b
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 1,349 deletions.
3 changes: 2 additions & 1 deletion README.md
@@ -1,4 +1,4 @@
# Makeblock Library v3.26
# Makeblock Library v3.27

Arduino Library for Makeblock Electronic Modules

Expand Down Expand Up @@ -60,5 +60,6 @@ If you have a discussion about licensing issues, please contact me (myan@makeblo
|Mark Yan | 2016/07/27 | 3.2.4 | fix some JIRA issue, add PID motion for Megapi/Auriga on board encoder motor.|
|Mark Yan   | 2018/05/16 | 3.2.5 | Correct copyright information.|
|Vincent He | 2019/01/04 | 3.2.6 | 1.Mbot /ranger adds the function of communication variables. 2.Solve the blocking problem of 9g steering gear. 3.Solve the problem that the intelligent steering gear cannot read back the parameters. 4.Add version number function. 5.High power code motor reinforcement version query function. 6.Solve the problem of SetColor (uint8_t index, long value) function error in mergharp.cpp. 7.The mBot board cannot extinguish the RGB. First upload the program with the RGB in any color, and then upload the program with the RGB in all colors. The RGB cannot extinguish (MeRGBLed bled. CPP file). 8.In the MegaPi firmware, SLOT1 is changed to slot_num instead of parameter transmission in the command processing stepper motor.|
|Vincent He | 2019/09/02 | 3.2.7 | 1.fix the problem that the electronic compass Mecompass is hung on the Orion mainboard 7 or 8 ports and communication will be hung dead. 2.fix the problem that the function getPointFast() in MeHumitureSensor.cpp does not normally output the value. 3.fix the problem that compile smartservo_test.ino firmware error report using the arduino1.6.5 environment with mBlock V3.4.12. 4.remove MeSuperVariable.cpp/MeSuperVariable.h. 5.fix the problem that ultrasonic module can only measure the maximum range of 375cm,and the maximum range of normal requirements is 400cm.|

### Learn more from Makeblock official website: www.makeblock.com
2 changes: 1 addition & 1 deletion library.properties
@@ -1,5 +1,5 @@
name=MakeBlockDrive
version=3.26
version=3.27
author=Mark Yan, Makeblock
maintainer=MakeBlock <www.makeblock.cc>
sentence= Use to drive all devices provided by Makeblock company.
Expand Down
1 change: 0 additions & 1 deletion src/MeAuriga.h
Expand Up @@ -76,7 +76,6 @@
#include "MePS2.h"
#include "MePm25Sensor.h"
#include "MeColorSensor.h"
#include "MeSuperVariable.h"
/********************* Auriga Board GPIO Map *********************************/
// struct defined in MeAuriga.h
MePort_Sig mePort[17] =
Expand Down
2 changes: 1 addition & 1 deletion src/MeColorSensor.h
Expand Up @@ -72,7 +72,7 @@
#include <stdbool.h>
#include <Arduino.h>
#include "MeConfig.h"
#include "Wire.h"

#ifdef ME_PORT_DEFINED
#include "MePort.h"
#endif // ME_PORT_DEFINED
Expand Down
56 changes: 47 additions & 9 deletions src/MeCompass.cpp
Expand Up @@ -40,6 +40,7 @@
* `<Author>` `<Time>` `<Version>` `<Descr>`
* Lawrence 2015/09/03 1.0.0 Rebuild the old lib.
* Lawrence 2015/09/08 1.0.1 Added some comments and macros.
* Vincent He 2019/03/01 1.0.2 fix issue: In the Orion board, the electronic compass was hung in ports 7 and 8. To avoid the crash and added timeout processing.
* </pre>
*
* @example MeCompassTest.ino
Expand Down Expand Up @@ -188,6 +189,11 @@ void MeCompass::begin(void)
writeReg(COMPASS_RA_MODE, Measurement_Mode);

read_EEPROM_Buffer();

#ifdef COMPASS_SERIAL_DEBUG
Serial.println("Compass begin !!!");
#endif

deviceCalibration();
}

Expand Down Expand Up @@ -565,7 +571,7 @@ void MeCompass::deviceCalibration(void)
#endif
return;
}
long time_num,cal_time;
long time_num,cal_time,start_time;
bool LED_state = 0;
int16_t X_num,Y_num,Z_num;
int16_t X_max = -32768;
Expand All @@ -578,7 +584,7 @@ void MeCompass::deviceCalibration(void)
#ifdef COMPASS_SERIAL_DEBUG
Serial.println("Compass calibration !!!");
#endif
time_num = millis();
start_time = time_num = millis();
#ifdef ME_PORT_DEFINED
while(dRead1(INPUT_PULLUP) == 0)
#else // ME_PORT_DEFINED
Expand All @@ -598,8 +604,16 @@ void MeCompass::deviceCalibration(void)
digitalWrite(_ledPin, LED_state);
#endif
#ifdef COMPASS_SERIAL_DEBUG
Serial.println("You can free the KEY now ");
//Serial.println("You can free the KEY now ");
#endif
}
#ifdef COMPASS_SERIAL_DEBUG
Serial.println(millis(),DEC);
Serial.println(start_time,DEC);
#endif
if( millis() - start_time > 300 ) //timeout!
{
break;
}
}
#ifdef COMPASS_SERIAL_DEBUG
Expand All @@ -610,6 +624,7 @@ void MeCompass::deviceCalibration(void)
#ifndef ME_PORT_DEFINED
pinMode(_keyPin, INPUT_PULLUP);
#endif
start_time = millis();
do
{
if(millis() - time_num > 200) //control the LED
Expand Down Expand Up @@ -653,12 +668,23 @@ void MeCompass::deviceCalibration(void)
Z_max = Z_num;
}
}
if( millis() - start_time > 300 ) //timeout!
{
break;
}
}
#ifdef ME_PORT_DEFINED
while(dRead1(INPUT_PULLUP)==1);
while(dRead1(INPUT_PULLUP) == 1);
dWrite2(LOW); //turn off the LED
#else // ME_PORT_DEFINED
while(digitalRead(_keyPin) == 1);
start_time = millis();
while(digitalRead(_keyPin) == 1)
{
if( millis() - start_time > 10 ) //timeout!
{
break;
}
}
pinMode(_ledPin, OUTPUT);
digitalWrite(_ledPin, LOW);
#endif
Expand Down Expand Up @@ -697,15 +723,27 @@ void MeCompass::deviceCalibration(void)
write_EEPROM_Buffer(&Cal_parameter);
#ifdef ME_PORT_DEFINED
dWrite2(HIGH); //turn on the LED
start_time = millis();
while(dRead1(INPUT_PULLUP) == 0)
{
wdt_reset();
};
{
wdt_reset();
if( millis() - start_time > 10 ) //timeout!
{
break;
}
}
#else // ME_PORT_DEFINED
pinMode(_ledPin, OUTPUT);
digitalWrite(_ledPin, HIGH);
pinMode(_keyPin, INPUT_PULLUP);
while(digitalRead(_keyPin) == 0);
start_time = millis();
while(digitalRead(_keyPin) == 0)
{
if( millis() - start_time > 10 ) //timeout!
{
break;
}
}
#endif
wdt_reset();
delay(100);
Expand Down
2 changes: 1 addition & 1 deletion src/MeHumitureSensor.cpp
Expand Up @@ -417,7 +417,7 @@ double MeHumiture::getPointFast()
{
double a = 17.271;
double b = 237.7;
double temp = (a * Temperature) / (b + Temperature) + log(Humidity/100);
double temp = (a * Temperature) / (b + Temperature) + log((double)Humidity/100);
//double Td = (b * temp) / (a - temp);
return ((b * temp) / (a - temp));
}
Expand Down
1 change: 0 additions & 1 deletion src/MeMCore.h
Expand Up @@ -73,7 +73,6 @@
#include "MeGasSensor.h"
#include "MePS2.h"
#include "MeColorSensor.h"
#include "MeSuperVariable.h"
/********************* Mbot Board GPIO Map *********************************/
MePort_Sig mePort[17] =
{
Expand Down

0 comments on commit 3a0e66b

Please sign in to comment.