Changement de l'adresse IP fixe pour DHCP. Pas tout à fait la version 01.00.2 qui roule mais presque. J'ai fiat quelques gossages de plus après avoir flashé et avant le commit
This commit is contained in:
@@ -57,6 +57,7 @@ tstrWifiInitParam param;
|
|||||||
uint8 mac_addr[6];
|
uint8 mac_addr[6];
|
||||||
uint8 u8IsMacAddrValid;
|
uint8 u8IsMacAddrValid;
|
||||||
struct sockaddr_in addr_in;
|
struct sockaddr_in addr_in;
|
||||||
|
uint32 mCurIPAddress;
|
||||||
|
|
||||||
tstrM2MIPConfig mModuleIPConfig;
|
tstrM2MIPConfig mModuleIPConfig;
|
||||||
|
|
||||||
@@ -307,6 +308,7 @@ static void wifi_cb(uint8 u8MsgType, void *pvMsg)
|
|||||||
#else
|
#else
|
||||||
m2m_wifi_set_static_ip(&mModuleIPConfig);
|
m2m_wifi_set_static_ip(&mModuleIPConfig);
|
||||||
gbConnectedWifi = true;
|
gbConnectedWifi = true;
|
||||||
|
mCurIPAddress = mModuleIPConfig.u32StaticIP;
|
||||||
#endif
|
#endif
|
||||||
mWiFiState = WIFI_CONNECTED_STATE;
|
mWiFiState = WIFI_CONNECTED_STATE;
|
||||||
} else if (pstrWifiState->u8CurrState == M2M_WIFI_DISCONNECTED)
|
} else if (pstrWifiState->u8CurrState == M2M_WIFI_DISCONNECTED)
|
||||||
@@ -316,6 +318,7 @@ static void wifi_cb(uint8 u8MsgType, void *pvMsg)
|
|||||||
mWiFiState = WIFI_DISCONNECTED_STATE;
|
mWiFiState = WIFI_DISCONNECTED_STATE;
|
||||||
CloseSockets();
|
CloseSockets();
|
||||||
m2m_periph_gpio_set_val(M2M_PERIPH_GPIO3,0);
|
m2m_periph_gpio_set_val(M2M_PERIPH_GPIO3,0);
|
||||||
|
mCurIPAddress = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -323,14 +326,17 @@ static void wifi_cb(uint8 u8MsgType, void *pvMsg)
|
|||||||
|
|
||||||
case M2M_WIFI_REQ_DHCP_CONF:
|
case M2M_WIFI_REQ_DHCP_CONF:
|
||||||
{
|
{
|
||||||
uint8 *pu8IPAddress = (uint8 *)pvMsg;
|
mCurIPAddress = *(uin32*)pvMsg;
|
||||||
|
|
||||||
// unsigned char ip1,ip2,ip3,ip4;
|
// unsigned char ip1,ip2,ip3,ip4;
|
||||||
// ip1 = pu8IPAddress[0];
|
// ip1 = IPV4_BYTE(pu8IPAddress,0);
|
||||||
// ip2 = pu8IPAddress[1];
|
// ip2 = IPV4_BYTE(pu8IPAddress,1);
|
||||||
// ip3 = pu8IPAddress[2];
|
// ip3 = IPV4_BYTE(pu8IPAddress,2);
|
||||||
// ip4 = pu8IPAddress[3];
|
// ip4 = IPV4_BYTE(pu8IPAddress,3);
|
||||||
|
|
||||||
|
|
||||||
/* Turn LED0 on to declare that IP address received. */
|
/* Turn LED0 on to declare that IP address received. */
|
||||||
printf("Wi-Fi IP is %u.%u.%u.%u\r\n", pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]);
|
// printf("Wi-Fi IP is %u.%u.%u.%u\r\n", pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]);
|
||||||
gbConnectedWifi = true;
|
gbConnectedWifi = true;
|
||||||
/* Obtain the IP Address by network name */
|
/* Obtain the IP Address by network name */
|
||||||
gethostbyname((uint8 *)server_host_name);
|
gethostbyname((uint8 *)server_host_name);
|
||||||
@@ -367,6 +373,7 @@ int InitWiFi()
|
|||||||
|
|
||||||
gbTcpConnection = false;
|
gbTcpConnection = false;
|
||||||
TimerStart(WIFI_RECONNECT_TIMER,1);
|
TimerStart(WIFI_RECONNECT_TIMER,1);
|
||||||
|
mCurIPAddress = 0xFFFFFFFF;
|
||||||
|
|
||||||
char IP1,IP2,IP3,IP4,GW1,GW2,GW3,GW4;
|
char IP1,IP2,IP3,IP4,GW1,GW2,GW3,GW4;
|
||||||
|
|
||||||
@@ -385,10 +392,6 @@ int InitWiFi()
|
|||||||
GW3 = StoredIPConfig[6];
|
GW3 = StoredIPConfig[6];
|
||||||
GW4 = StoredIPConfig[7];
|
GW4 = StoredIPConfig[7];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((IP1 == (char)0xFF) && (IP2 == (char)0xFF) && (IP3 == (char)0xFF) && (IP4 == (char)0xFF) || \
|
if((IP1 == (char)0xFF) && (IP2 == (char)0xFF) && (IP3 == (char)0xFF) && (IP4 == (char)0xFF) || \
|
||||||
((GW1 == (char)0xFF && GW2 == (char)0xFF && GW3 == (char)0xFF && GW4 == (char)0xFF)))
|
((GW1 == (char)0xFF && GW2 == (char)0xFF && GW3 == (char)0xFF && GW4 == (char)0xFF)))
|
||||||
{
|
{
|
||||||
@@ -408,14 +411,14 @@ int InitWiFi()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
IP1 = STATIC_IP_ADDRESS_1;
|
IP1 = STATIC_IP_ADDRESS_1;
|
||||||
IP2 = STATIC_IP_ADDRESS_2;
|
IP2 = STATIC_IP_ADDRESS_2;
|
||||||
IP3 = STATIC_IP_ADDRESS_3;
|
IP3 = STATIC_IP_ADDRESS_3;
|
||||||
IP4 = STATIC_IP_ADDRESS_4;
|
IP4 = STATIC_IP_ADDRESS_4;
|
||||||
|
|
||||||
GW1 = GATEWAY_ADDRESS_1;
|
GW1 = GATEWAY_ADDRESS_1;
|
||||||
GW2 = GATEWAY_ADDRESS_2;
|
GW2 = GATEWAY_ADDRESS_2;
|
||||||
GW3 = GATEWAY_ADDRESS_3;
|
GW3 = GATEWAY_ADDRESS_3;
|
||||||
GW4 = GATEWAY_ADDRESS_4;
|
GW4 = GATEWAY_ADDRESS_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void SendBootloaderData(uint8 *data, int size);
|
|||||||
void SendBootloaderByte(uint8 data);
|
void SendBootloaderByte(uint8 data);
|
||||||
int IsBootloaderClientConnected();
|
int IsBootloaderClientConnected();
|
||||||
|
|
||||||
#define USE_STATIC_IP
|
//#define USE_STATIC_IP
|
||||||
|
|
||||||
|
|
||||||
// <<< Use Configuration Wizard in Context Menu >>>
|
// <<< Use Configuration Wizard in Context Menu >>>
|
||||||
@@ -104,9 +104,9 @@ int IsBootloaderClientConnected();
|
|||||||
//#define HOME_AP_NAME "ImprVEmard"
|
//#define HOME_AP_NAME "ImprVEmard"
|
||||||
//#define HOME_AP_PWD "12345fffff"
|
//#define HOME_AP_PWD "12345fffff"
|
||||||
|
|
||||||
//#define HOME_AP_NAME "ChaletVilleEmard"
|
#define HOME_AP_NAME "ChaletVilleEmard"
|
||||||
//#define HOME_AP_NAME "ElRouteurDuChalet"
|
//#define HOME_AP_NAME "ElRouteurDuChalet"
|
||||||
#define HOME_AP_NAME "LeChalet"
|
//#define HOME_AP_NAME "LeChalet"
|
||||||
#define HOME_AP_PWD "Evinrude30"
|
#define HOME_AP_PWD "Evinrude30"
|
||||||
|
|
||||||
#define TERMINAL_SERVER_PORT 85
|
#define TERMINAL_SERVER_PORT 85
|
||||||
@@ -119,12 +119,12 @@ int IsBootloaderClientConnected();
|
|||||||
//Module Static IP settings
|
//Module Static IP settings
|
||||||
#define STATIC_IP_ADDRESS_1 192
|
#define STATIC_IP_ADDRESS_1 192
|
||||||
#define STATIC_IP_ADDRESS_2 168
|
#define STATIC_IP_ADDRESS_2 168
|
||||||
#define STATIC_IP_ADDRESS_3 50
|
#define STATIC_IP_ADDRESS_3 30
|
||||||
#define STATIC_IP_ADDRESS_4 126
|
#define STATIC_IP_ADDRESS_4 125
|
||||||
|
|
||||||
#define GATEWAY_ADDRESS_1 192
|
#define GATEWAY_ADDRESS_1 192
|
||||||
#define GATEWAY_ADDRESS_2 168
|
#define GATEWAY_ADDRESS_2 168
|
||||||
#define GATEWAY_ADDRESS_3 50
|
#define GATEWAY_ADDRESS_3 30
|
||||||
#define GATEWAY_ADDRESS_4 1
|
#define GATEWAY_ADDRESS_4 1
|
||||||
|
|
||||||
#define DEFAULT_DNS_ADD_1 8
|
#define DEFAULT_DNS_ADD_1 8
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ int main(void)
|
|||||||
|
|
||||||
#ifndef NO_WIFI
|
#ifndef NO_WIFI
|
||||||
InitTerminal();
|
InitTerminal();
|
||||||
// InitWiFi();
|
InitWiFi();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
#define VERSIONNUMBER "CHALET_V01.00.1" //shall be 15 chars...
|
#define VERSIONNUMBER "CHALET_V01.00.2" //shall be 15 chars...
|
||||||
|
//Force DHCP instead of static IP.
|
||||||
|
|
||||||
|
//#define VERSIONNUMBER "CHALET_V01.00.1" //shall be 15 chars...
|
||||||
//#define VERSIONNUMBER "-__--TEST--__" //shall be 15 chars...
|
//#define VERSIONNUMBER "-__--TEST--__" //shall be 15 chars...
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+7299
-7304
File diff suppressed because it is too large
Load Diff
+1081
-1082
File diff suppressed because it is too large
Load Diff
@@ -17,9 +17,14 @@
|
|||||||
</editor-bookmarks>
|
</editor-bookmarks>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/ProtocolDefs.h</file>
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/main.c</file>
|
||||||
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/BootloaderInterface.c</file>
|
||||||
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/WiFiCtrl.c</file>
|
||||||
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/winc3400/socket/source/socket.c</file>
|
||||||
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/LoraNetworkInterface.c</file>
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/LoraNetworkInterface.c</file>
|
||||||
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/main.h</file>
|
||||||
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/WiFiCtrl.h</file>
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/WiFiCtrl.h</file>
|
||||||
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/Terminal.c</file>
|
||||||
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/versionbuild.h</file>
|
<file>file:/D:/Main/PicDev/Projets/ChaletLora/ChaletLora.X/Source/versionbuild.h</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
|
|||||||
Reference in New Issue
Block a user