From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23639 invoked by alias); 15 Apr 2005 14:18:12 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 23331 invoked from network); 15 Apr 2005 14:17:33 -0000 Received: from unknown (HELO smtpauth06.mail.atl.earthlink.net) (209.86.89.66) by sourceware.org with SMTP; 15 Apr 2005 14:17:33 -0000 Received: from [66.47.90.38] (helo=traveller) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1DMRdU-0004fI-4P; Fri, 15 Apr 2005 10:17:32 -0400 From: "Frank Pagliughi" To: "Magnus Ottosson" Cc: Date: Fri, 15 Apr 2005 14:21:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit In-Reply-To: <425F7DD0.7000008@ituniv.se> X-ELNK-Trace: 4d82f965df0f6dd9e3f977c6d1ea408f0a9da525759e265492269dc818fe007e0d3b65511abbc87ed81f49743ecfecf5350badd9bab72f9c350badd9bab72f9c Subject: RE: [ECOS] Re: Clear Screen X-SW-Source: 2005-04/txt/msg00174.txt.bz2 i386 Target, huh? Are you sending the output to a serial port or to a VGA screen? If a serial port, then it's the terminal emulator program on the host that needs to ANSI support, not your application. If you're using a VGA screen, you can always write directly to the video memory. In text mode, it starts at 0xB8000. Search the web for more info, or look for an old book on DOS. I don't know how eCos positions the cursor on a VGA screen, though. So printf() positions won't automatically be restarted at the top left after clearing. Here's an example for a standard VGA in standard 80x25 text mode: // -------------------------------------- // conio_test.c // // Test of the PC console I/O functions. // These are fast direct-to-video-memory routines. #include typedef unsigned char byte; #define SCR_WD 80 #define SCR_HT 25 typedef struct tag_chel { char ch; // Char displayed byte attr; // FG & BG colors } chel; typedef chel chel_line[80]; chel_line *pc_scr = ((chel_line*) 0xB8000); static byte scrattr = 0x07; // White FG on black BG // -------------------------------------- void clrscr(void) { int x, y; for (y=0; yI have compiled the application for i386 target. It shall run on a P4-M. >See atachment for my Makefile. > >I have tried printf("\033[2J") > >I will try: > >void clearToEOL(void) > { > printf("\033[K") > } > >void moveCursor(int row, int col) > { > printf("\033[%d;%dH",row, col) > } > >To if they work. > >//Magnus. > > > >Grant Edwards wrote: > > > >>In gmane.os.ecos.general, you wrote: >> >> >> >> >> >>>I wan't to know if it's possible to clear the screen or update a >>>specific line with eCos? >>> >>> >>> >>> >>Depends on what screen you're using. >> >> >> >> >> >>>I have an application that writes data on the screen with >>>printf() and I want to clear this data and write new. Is there >>>a clear screen function or something like it? >>> >>> >>> >>> >>Assuming you're using an ANSI terminal, writing such functions >>is pretty simple: >> >>void clearScreen(void) >> { >> printf("\033[2J") >> } >> >>void clearToEOL(void) >> { >> printf("\033[K") >> } >> >>void moveCursor(int row, int col) >> { >> printf("\033[%d;%dH",row, col) >> } >> >>and so on. >> >> >> >> >> > > > >------------------------------------------------------------------------ > >INSTALL_DIR = /home/supersonic/i386library_install >COMPILER_DIR = /opt/ecos/gnutools/i386-elf/bin >BOOT_DIR = /boot/ >EXE_SOURCE = sigSonarServer.c >EXE_OUTPUT = sigSonarServer > >include $(INSTALL_DIR)/include/pkgconf/ecos.mak > >COMPILER = $(COMPILER_DIR)/i386-elf-gcc >COMPILER_FLAGS = -I$(INSTALL_DIR)/include >LINKER_FLAGS = -nostartfiles -L$(INSTALL_DIR)/lib -Ttarget.ld > >$(EXE_OUTPUT): obj.o > $(COMPILER) $(LINKER_FLAGS) $(ECOS_GLOBAL_LDFLAGS) -o $@ obj.o > -rm -f obj.o >obj.o: $(EXE_SOURCE) > $(COMPILER) -c -o obj.o $(COMPILER_FLAGS) $(ECOS_GLOBAL_CFLAGS) \ > $(EXE_SOURCE) > >.PHONY: clean install >clean: > -rm -f $(EXE_OUTPUT) >install: > cp ./$(EXE_OUTPUT) $(BOOT_DIR) > >------------------------------------------------------------------------ > >/*///////////////////////////////////////////////////////////////////////// //// > > Project: Sea Grid > > Module: Sonar Control > > Description: > > Author: Magnus Ottosson, it3otma@ituniv.se > > Co Authors: N/A > > Created: 2005-03-31 > >/////////////////////////////////////////////////////////////////////////// ///*/ > >#include >#include >#include >#include >#include >#include "sigSonarControl/sigSonarControl.h" > >#define KEYBOARD 0x60 > >void drawRootMenu(positions* currentPositions); >void drawPositionsMenu(positions* currentPositions); > >void drawRootMenu(positions* currentPositions){ > > printf("\033[K"); > printf(" -------------------------------------- \n"); > printf(" | ++ Sonar Server ++ |\n"); > printf(" | ~~~~~~~~~~~~ |\n"); > printf(" | (1) See positions |\n"); > printf(" | (q) Quit |\n"); > printf(" | |\n"); > printf(" | Make a choice |\n"); > printf(" | |\n"); > printf(" -------------------------------------- \n"); > > unsigned int input = 0; > > while (1) { > > HAL_READ_UINT8(KEYBOARD, input); > > if (input == 130) { > drawPositionsMenu(currentPositions); > break; > } else if (input == 129) { > // QUIT; > } > } >} > >void drawPositionsMenu(positions* currentPositions){ > > unsigned int input = 0; > > while (1) { > > HAL_READ_UINT8(KEYBOARD, input); > > printf("\033[K"); > printf(" -------------------------------------- \n"); > printf(" | ++ Sonar Server Current Positions ++ |\n"); > printf(" | ~~~~~~~~~~~~ |\n"); > printf(" | Lorry |\n"); > printf(" | ---------------- |\n"); > printf(" | Front X: %d |\n",currentPositions -> currentLorryPos.frontX); > printf(" | Front Y: %d |\n",currentPositions -> currentLorryPos.frontY); > printf(" | Rear X: %d |\n",currentPositions -> currentLorryPos.rearX); > printf(" | Rear Y: %d |\n",currentPositions -> currentLorryPos.rearY); > printf(" | Angle : %f |\n",currentPositions -> currentLorryPos.angle); > printf(" | |\n"); > printf(" | Barge |\n"); > printf(" | ---------------- |\n"); > printf(" | Front X: %d |\n",currentPositions -> currentBargePos.frontX); > printf(" | Front Y: %d |\n",currentPositions -> currentBargePos.frontY); > printf(" | Rear X: %d |\n",currentPositions -> currentBargePos.rearX); > printf(" | Rear Y: %d |\n",currentPositions -> currentBargePos.rearY); > printf(" | Angle : %f |\n",currentPositions -> currentBargePos.angle); > printf(" | |\n"); > printf(" | Press ESC to return to root menu |\n"); > printf(" | |\n"); > printf(" -------------------------------------- \n"); > > if (input == 129) { > drawRootMenu(currentPositions); > break; > } > } >} > > >int main(void) { > > // Create the positions struct > // Allocate the memory for the position struct. > currentPositions = (positions*) malloc(sizeof(positions)); > // Initialize the values to -1 > currentPositions -> currentBargePos.angle = 1.0; > currentPositions -> currentBargePos.frontX = 1; > currentPositions -> currentBargePos.frontY = 1; > currentPositions -> currentBargePos.rearX = 1; > currentPositions -> currentBargePos.rearY = 1; > > currentPositions -> currentLorryPos.angle = 1.0; > currentPositions -> currentLorryPos.frontX = 1; > currentPositions -> currentLorryPos.frontY = 1; > currentPositions -> currentLorryPos.rearX = 1; > currentPositions -> currentLorryPos.rearY = 1; > > // TODO: Thread > drawRootMenu(currentPositions); > > // TODO: Thread > // startbeacons(); > > // TODO: Thread > // listenToRadioReceiver(currentPositions); > > > return 0; >} > > > > -- ----------------------------------- Contact information Phone: (+46) (0) 31 206700 Mobile: (+46) (0) 733-908060 Email: it3otma@ituniv.se -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss