public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Frank Pagliughi" <fpagliughi@mindspring.com>
To: "Magnus Ottosson" <it3otma@ituniv.se>
Cc: <ecos-discuss@ecos.sourceware.org>
Subject: RE: [ECOS] Re: Clear Screen
Date: Fri, 15 Apr 2005 14:40:00 -0000	[thread overview]
Message-ID: <JMEAKDCKCGBKENKKKJIGGEFJCHAA.fpagliughi@mindspring.com> (raw)
In-Reply-To: <425F7DD0.7000008@ituniv.se>

Oh, one more thing...

A serial terminal emulator may also clear it's display if you send it a Form
Feed character:

  putchar('\f');

Frank

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org]On Behalf Of Magnus
Ottosson
Sent: Friday, April 15, 2005 4:40 AM
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: Clear Screen


Neither of these options work. I guess that when I built eCos I did not
build it with a terminal that support ansi? How would I do this?

Magnus

Magnus Ottosson wrote:

>I 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 <stdlib.h>
>#include <stdio.h>
>#include <cyg/hal/hal_io.h>
>#include <cyg/kernel/kapi.h>
>#include <cyg/io/devtab.h>
>#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

  parent reply	other threads:[~2005-04-15 14:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-14 15:24 [ECOS] " Magnus Ottosson
2005-04-14 15:56 ` [ECOS] " Grant Edwards
2005-04-15  8:40   ` Magnus Ottosson
2005-04-15  8:58     ` Magnus Ottosson
2005-04-15 14:21       ` Frank Pagliughi
2005-04-15 14:40       ` Frank Pagliughi [this message]
2005-04-16 11:32       ` Grant Edwards
2005-04-15 14:41     ` Grant Edwards
2005-04-14 15:57 ` [ECOS] " Gary Thomas
2005-04-14 16:03 ` [ECOS] Insight gdb Preferences under Linux Hoat Frank Pagliughi
2005-04-14 16:16   ` dirk husemann
2005-04-14 16:18     ` dirk husemann
2005-04-14 19:46 ` [ECOS] Clear Screen Nick Garnett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=JMEAKDCKCGBKENKKKJIGGEFJCHAA.fpagliughi@mindspring.com \
    --to=fpagliughi@mindspring.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=it3otma@ituniv.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).