From 0debc594c8ccb6a7e6020b39f1d7434faa50f79a Mon Sep 17 00:00:00 2001 From: maxxir Date: Sun, 20 Jan 2019 23:26:56 +0400 Subject: [PATCH] Some minor changes and add double-IP config for [11_m1284p_WIZNET_HTTPServer_FLASH_pages] --- 11_m1284p_WIZNET_HTTPServer_FLASH_pages/globals.h | 4 ++- 11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c | 30 +++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/11_m1284p_WIZNET_HTTPServer_FLASH_pages/globals.h b/11_m1284p_WIZNET_HTTPServer_FLASH_pages/globals.h index cb9b249..0e68a16 100644 --- a/11_m1284p_WIZNET_HTTPServer_FLASH_pages/globals.h +++ b/11_m1284p_WIZNET_HTTPServer_FLASH_pages/globals.h @@ -16,13 +16,15 @@ //#define HTTPD_MAX_BUF_SIZE 2048 //For Mega1284p(16kb RAM)/Mega2560(8kb RAM) #define HTTPD_MAX_BUF_SIZE 512 //For Mega644p(4kb RAM)/Mega128(4kb RAM) -#define PRINTF_EN 0 +#define PRINTF_EN 1 #if PRINTF_EN #define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) #else #define PRINTF(...) #endif +//#define IP_WORK + extern unsigned long millis(void); extern int freeRam (void); diff --git a/11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c b/11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c index d8e4c27..927b04c 100644 --- a/11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c +++ b/11_m1284p_WIZNET_HTTPServer_FLASH_pages/main.c @@ -102,14 +102,25 @@ * Author of porting to AVR Mega: * Ibragimov Maxim, Russia Togliatty ~10..12.2018 */ -/* -#define PRINTF_EN 1 -#if PRINTF_EN -#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args) + +#ifdef IP_WORK +//NIC metrics for WORK PC +wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address + .ip = {192, 168, 0, 199}, // IP address + .sn = {255, 255, 255, 0}, // Subnet mask + .dns = {8,8,8,8}, // DNS address (google dns) + .gw = {192, 168, 0, 1}, // Gateway address + .dhcp = NETINFO_STATIC}; //Dynamic IP configuration from a DHCP sever #else -#define PRINTF(...) +//NIC metrics for another PC (second IP configuration) +wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address + .ip = {192, 168, 1, 199}, // IP address + .sn = {255, 255, 255, 0}, // Subnet mask + .dns = {8,8,8,8}, // DNS address (google dns) + .gw = {192, 168, 1, 1}, // Gateway address + .dhcp = NETINFO_STATIC}; //Dynamic IP configuration from a DHCP sever #endif -*/ + //*********Program metrics const char compile_date[] PROGMEM = __DATE__; // Mmm dd yyyy - Дата компиляции const char compile_time[] PROGMEM = __TIME__; // hh:mm:ss - Время компиляции @@ -288,13 +299,6 @@ unsigned char ethBuf1[ETH_MAX_BUF_SIZE]; unsigned char ethBuf2_WEBSRV[WEBSRV_DATA_BUF_SIZE]; */ -wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address - .ip = {192, 168, 0, 199}, // IP address - .sn = {255, 255, 255, 0}, // Subnet mask - .dns = {8,8,8,8}, // DNS address (google dns) - .gw = {192, 168, 0, 1}, // Gateway address - .dhcp = NETINFO_STATIC}; //Dynamic IP configruation from a DHCP sever - void cs_sel() { SPI_WIZNET_ENABLE(); }